Reply To: Formula does not work

Home Forums Product Price by Formula for WooCommerce Formula does not work Reply To: Formula does not work

Tom Anbinder
Plugin Support

Sure, no problem, happy to help 🙂

Regarding your task – if understood it correctly – one solution would be to re-calculate multipliers. I.e. if you need to multiply the price by 3.5, but it was already multiplied by 2.5, then you need to multiply only by 1.4, because 3.5 / 2.5 = 1.4, i.e. x * 3.5 is the same as x * 2.5 * 1.4. Hope you get the idea. So your formula would look like this:

x[if_value value="{product_meta key='_price'}" compare_operator="less" compare_to_value="50"]*2.5[/if_value]
[if_value value="{product_meta key='_price'}" compare_operator="less" compare_to_value="100"]*1.4[/if_value]
[if_value value="{product_meta key='_price'}" compare_operator="less" compare_to_value="150"]*1.2857[/if_value]

Now after your question, I’m thinking that I should add new between value to the compare_operator attribute in the [if_value] the shortcode, so it could be used like that:

x[if_value value="{product_meta key='_price'}" compare_operator="between" compare_to_value="50,100"]*2.5[/if_value]

I.e. compare_to_value attribute would be set as comma separated values. Will be adding that in next plugin version.

Hope that helps.

P.S. If you like the plugin, please consider leaving us a rating.