Dynamically Changing Variation Price Not Working in WooCommerce 3.x

I’m at the end of my rope here. My client applied the update to WooCommerce 3.x, and now a custom plugin I had isn’t working. The plugin essentially added a certain amount to the price of a product based on the user’s postal code. It will work for regular products, but not for variable/variation products. I know the filters for “woocommerce_get_price” has changed, but I can’t see any mention of “woocommerce_variation_prices_price” being changed or deprecated.

Any ideas or help would be greatly appreciated. The plugin worked fine until the update to 3.x.

Here are the filters that were working fine before:

add_filter(‘woocommerce_variation_prices_price’,’zp_custom_variation_prices_price’, 10, 2);
add_filter(‘woocommerce_variation_prices_regular_price’,’zp_custom_variation_prices_price’, 10, 2);
add_filter(‘woocommerce_variation_prices_sale_price’,’zp_custom_variation_prices_price’, 10, 2);

The zp_custom_variation_prices_price function spits out a new price based on their location for each variation. I have confirmed that this function properly spits out the adjusted price for each of the variations. The filters just don’t seem to apply the price with the adjustment.

At a loss here. Thanks in advance.


Read more here: Dynamically Changing Variation Price Not Working in WooCommerce 3.x

Leave a Reply

Your email address will not be published. Required fields are marked *