Include the first extra in the search by price

Hi developed this site ( ) with your theme and plugin, i’m need to change the query of filter price. I’m need to take the price of the first extra product combination instead of the regular price of product. I’m searching in the plugin and theme but i’m in trouble beacuse i cant recover the query responsable of this feature. Can you help me?

I replied via email, will post the reply here in case if someone has the same issue:

Unfortunately it’s not possible because this filter searches base prices, excluding the pricing extras. It may be possible to add the first extra amount to the base price on save, but this will probably cause issues because the listing base price would be (base price + first extra), and selecting this extra would add its amount again.

Thanks for the quick reply, but I need to add this feature otherwise I can’t deliver the site to my client.
Then the request is not very difficult, I try to explain myself better because I have already found a possible solution, but I need your help because with the documentation I could not find the query that I have to modify.
Then I’ll explain how a user can currently create a product on this site.
After registering and confirming his registration, the user can click on “upload video” and will access the page
( in which he can create his service. I made many changes compared to the basic template because my client does not sell a finished product but it is a modular service in which there are no mandatory services. So it is necessary that the price starts from 0.
In fact, thanks to the help of the jquery I have hidden the input of the base price and set it (always with the jquery) to 0, and I have made the first additional service mandatory (always with the jquery). So that even if the user cannot set the base price, he must set at least one item that would be the price of the video and if he wants to add the sharing option on social channels and set the relative price. And this works correctly, in fact from the frontend if a customer wants to buy something he sees that the starting price is 0, but he is obliged to select at least one additional service otherwise he cannot proceed with the purchase. And that’s exactly what my client wanted. The only problem I have to solve is precisely the price filter, because now having set everything to 0 it is not possible to filter by price.
So what I need to do is go inside the query which takes the prices of the products from the database and change it to the first additional service which is always tied to the product so I should add a simple join to the query so that I can have the price of the service and I return it to the function and that’s it.

I replied via email, will copy the reply here in case if someone has the same issue:

If you’re familiar with coding I can suggest the easiest way to do this, but this requires customizations in any case.

You can try using this hook Action: hivepress/v1/models/{model_name}/search | HivePress Hook Reference for listings (set a high priority, e.g. 1000 so it’ll be called after the default HivePress search), and unset the meta clause for the price, so the price filter will be visible but it will not try to search the price you made hidden. Then, add your own custom meta clause, you can get the price filter values from $_GET, sanitize/validate them and use them in the meta clause for a custom field that contains the first extra price. Since extras are stored as an array, this will probably require saving the extra amount in a separate meta field on hivepress/v1/models/listing/update action hook.

Hope this helps.

Where can I find more information on how to work on filters and actions?
Because I know the wordpress ones, but I can’t understand how it is organized within your plugin.
Can you give me some more detailed indications to get to the solution?

These work in the same way as WordPress actions and filters, but as usual each action and filter has its own accepted and returned parameters, please check the reference here Home | HivePress Hook Reference You can also browse sample snippets in our collection, to check how actions/filters can be used Search · user:hivepress hivepress/v1 · GitHub

Hi, if you gets this code to work, can you please share your php code snippet here. That is if you are doing it via snippet and don’t mine.

It would be appreciated as it would be nice to have this option, but I do not know how to code.


I am working on it when it will be functional I will share it. Although it would be useful to have the support of the developers of this great theme to achieve the goal.
You should arrange paid customization services for those like me who need to do something more.

Thanks, we’ll consider adding it as an option in HivePress/Settings/Listings/Selling but unfortunately there’s no simple temporary code snippet for this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.