Display price including commissions

Hello,

As mentioned in another post, I would like to include the user’s commission rate in the price. So I tried to customize the hivepress/v1/fields/currency/display_value.

However, when we modify the Hook Currency, if we add 15% to $this->value, the default ad price will be increased by 15%. The worry is that the “levels/supplements” will also be increased by 15% via this modification (which makes sense), but examining the code in includes/components/class-marketplace, there’s the hp_user_commission_rate which is already increasing the levels/supplements. So we end up with a price that’s increased by 30% in the levels/supplements when the ad is selected. This is due to the fact that the 3 fields (price / price levels / price supplements) are of monetary attribute type.

It would therefore be necessary to display the price of the first price level by default, as the price currently displayed by default is that of the woocommerce product. Or change the display format of this one, but I don’t know where it is.

Can you help me with this customization? I know there is no snippet for this but we have some PHP development skills so no worries.

Best regards,
Nolan

Please try targeting the price field only, you can do this by checking the field name via $field->get_name(), or check the request context to exclude the price display on other pages (e.g. if there’s a field with the same name but it’s not related to listings). You can also check $field->get_context() and/or $field->get_args() to target the listing price only.

Hope this helps.

1 Like

Thanks to you! It works great with the get_name()!

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