I am using Discount Rules for WooCommerce - PRO plugin. But it is not changing price with PHP and it's a problem when it comes to Facebook catalog.
For example I have with discount rule:
- on backend regular price (without sale price) is 11.99 €
- on front end regular price is 11.99 € and sale price is 10,55 €.
For facebook catalog the price 11.99 € and this is problem because it calls $product->get_price(). I tried to use the hook "woocommerce_product_get_price" like:
add_filter('woocommerce_product_get_price', 'manipulating_price_with_discount_rule_price', 9999, 2);
function manipulating_price_with_discount_rule_price($price, $product) {
$discounted_plugin_price = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', false, $product, 1, 0, 'all', true);
if (is_array($discounted_plugin_price) && isset($discounted_plugin_price['discounted_price']) && is_numeric($discounted_plugin_price['discounted_price'])) {
$current_plugin_price = round($discounted_plugin_price['discounted_price'], 2);
}
if (isset($current_plugin_price)) {
$price = $current_plugin_price;
}
return $price;
}
The page has stopped working due to memory size issues, even though the filter priority is set very low. Has anyone else encountered a similar problem?