Return the Starting Price by Bedroom Count by Asset
This document describes how to retrieve the lowest price (starting price) by bedroom count from Spaces using shortcode.
Shortcode Method
Spaces provides a shortcode that displays the lowest available price for each bedroom type (Studio, 1BR, 2BR, etc.).
Basic Shortcode
[spaces_room_price asset_id="XXXXX"]
Replace XXXXX with the WordPress post ID of the Spaces Asset.
Where to find the asset ID
CMS → Spaces Assets list → “Shortcode” column
Or from the edit page URL:
/wp-admin/post.php?post=12345&action=edit
Example Output
1 Bedroom starting at: $1,890
2 Bedrooms starting at: $2,830
Studios starting at: $1,545
Notes
- Only available units are included.
- Bedroom counts with no available units are excluded.
- If no units are available → returns an empty result.
Filter for a Single Bedroom Type
- To return only a single bedroom count:
[spaces_room_price asset_id="XXXXX" room_count="1"]
Use:
- 0 for studios
- 1, 2, 3 for bedroom counts
Overriding the HTML Output (Twig)
You can customize the output using a Twig template placed in:
/wp-content/[your-theme]/views/spaces-room-price.twig
Spaces will automatically use the override template if present.
Utility Method for Bedroom Prices
For PHP templates:
SPACES\Utility::spaces_get_min_price_for_room_count_by_asset( spaces_asset_id: 5, room_count: 2 // optional );
\SPACES\Utility::get_minimum_price_for_unit_by_custom_filter_value(
spaces_asset_id: 5,
room_count: 2 // optional
);
Returns:
- An array of bedroom types and their minimum prices
- Or a single type if room_count is provided
Starting Price by Custom Filter / Class (Penthouse, Premium, Renovated, Etc.)
Allows you to return the lowest “Starting At” price for any unit class defined via CMS tags—such as:
- Penthouse
- Renovated
- Premium
- Townhome
- ADA
Step 1 — Tag Units in the CMS
- Go to the Units list inside the Spaces Asset in the CMS.
- Open any unit you want to classify.
- Add a tag under Custom Filters (e.g., penthouse).
- Save the unit.
- Every unit tagged with penthouse will be included in Penthouse pricing queries.
Step 2 — Use the Utility Method
To retrieve the lowest price for all units tagged with a specific class:
SPACES\Utility::get_minimum_price_for_unit_by_custom_filter_value(
spaces_asset_id: 12345,
custom_filter_value: 'penthouse',
include_required_monthly_fees: false
);
The method returns the lowest unit-level price that matches the filter:
[
"min_price" => 4250,
"min_price_display" => "$4,250",
"unit_count" => 3
]
When to Use Class-Based Pricing
Use this method when:
- A floor plan includes both standard + penthouse units
- You want a “Penthouse starting at” section
- You need specialized marketing pricing per category
- You want clean separation between product lines
Notes & Best Practices
Bedroom-based price logic and class-based price logic are separate.
Use bedroom shortcode for general pricing by room type.
Use custom filter method for premium tiers (Penthouse, Renovated, VIP).
Tagging must be consistent to output accurate results.
If no units match the custom filter, the function returns false.
Updated 16 days ago