Directorist includes a Pricing field that allows listing owners to add pricing information to their listings. However, some directory websites need a more specific format, such as a minimum and maximum price:
$50 – $150
This is useful for service directories, restaurants, hotels, rental marketplaces, healthcare directories, and other websites where the final price may vary.
In this tutorial, we will add price-range support to the Directorist Pricing field using a custom extension.
Requirements
Before starting, make sure you have:
- WordPress installed
- Directorist installed and activated
- A directory type containing the Pricing field
- The custom Price Range extension
Download the custom extension from the pricing/range branch of the following GitHub repository:
https://github.com/MahfuzulAlam/directorist-custom-code/tree/pricing/range
This is a custom development extension and is not part of the standard Directorist installation.
Step 1: Download the Extension
Open the GitHub repository and switch to the pricing/range branch.
Download the branch as a ZIP file. Depending on the structure of the downloaded package, you may need to extract it and create a ZIP containing only the extension’s plugin folder.
The final ZIP should contain the main plugin file and the related extension files directly inside one plugin directory.
Step 2: Install the Extension
From your WordPress dashboard, navigate to:
Plugins → Add New Plugin → Upload Plugin
Choose the extension ZIP file and click Install Now.
After the installation is complete, click Activate Plugin.
Because this extension modifies the behavior of a Directorist field, Directorist must remain installed and activated.
Step 3: Add the Pricing Field
Navigate to:
Directory Listings → Directory Builder
Select the directory type you want to modify and open its Add Listing Form.
Add the standard Directorist Pricing field to the form if it is not already available.
Configure its label, description, required status, and other available settings. Then save the directory builder.
The custom extension extends the existing Pricing field, so you do not need to create two separate custom number fields for the minimum and maximum prices.
Step 4: Enter a Price Range
Open the frontend Add Listing or Edit Listing page.
The modified Pricing field should provide inputs for the lower and upper price values. For example:
- Minimum price:
50 - Maximum price:
150
Submit or update the listing.
The extension stores the supplied values with the listing and formats them as a price range when the listing is displayed.
Step 5: Display the Price Range
After publishing the listing, check the relevant Directorist layouts, including:
- All Listings page
- Search Results page
- Single Listing page
The price should appear in a range format similar to:
$50 – $150
The currency symbol, currency position, decimal formatting, and related presentation may depend on the pricing configuration available in Directorist.
Directorist also provides helper methods for checking whether a listing contains a normal price or a price range and for rendering the appropriate pricing template.
Testing the Implementation
Test the extension with several pricing combinations:
| Minimum | Maximum | Expected result |
|---|---|---|
| 50 | 150 | $50 – $150 |
| 100 | 100 | Verify how equal values are handled |
| Empty | 200 | Verify whether a partial range is allowed |
| 300 | 100 | Verify validation when minimum exceeds maximum |
| 25.50 | 75.99 | Verify decimal formatting |
You should also test creating and editing listings from both the frontend dashboard and the WordPress admin area.
Troubleshooting
The original Pricing field is still displayed
Confirm that the custom extension is activated and that you are using the standard Directorist Pricing field rather than a separate custom Number field.
The price range is saved but not displayed
Clear your site cache and inspect the layout in Directory Builder. If your theme overrides Directorist templates, the overridden pricing template may need to support the price-range output.
The currency is incorrect
Review the currency and price-formatting settings in Directorist. The extension should use the Directorist pricing configuration rather than requiring the currency symbol to be entered manually.
The customization stops working after an update
Do not modify Directorist core plugin files. Keep the customization inside the extension or a properly maintained child theme. Direct changes to plugin files can be overwritten during an update.
Important Considerations
Because this is a custom extension, test it on a staging website before installing it on a production directory.
You should also review the extension after major Directorist updates. Changes to pricing-field hooks, metadata, templates, or Directory Builder components may require compatibility updates.
Conclusion
The Price Range extension provides a practical way to collect and display minimum and maximum prices through the Directorist Pricing field.
Once installed, directory owners can present flexible pricing such as $50–$150 instead of displaying only a single fixed amount. This makes pricing information more accurate for listings whose costs depend on service level, duration, package, location, or other variables.




Leave a Comment