Discount rules always returning false
-
You have a lovely snippet which I understand is supposed to return the discount rules for the queried product… but when I apply it like below, it returns false on all products, regardless of whether they have an active discount or not. The discounts in question are all Buy One Get One Free offers, and they work in the cart so I know they are properly configured.
Here’s what I’m doing to add the promo after the “Add to cart” button on the product page for those to which it applies. Please can you spot what I’ve done wrong? Thanks! ??
// Finance table and promos after "Add to cart" add_action( 'woocommerce_after_add_to_cart_form', 'woo_finance_table_and_promos'); function woo_finance_table_and_promos(){ global $product; $product_price = $product->get_price(); $discount = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $product_price, $product, 1, 0, 'all', true); echo '<pre>' . print_r( $discount, true ) . '</pre>'; // then if I could get $discount to return anything other than false, I'd use it to display the offer here. }
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Discount rules always returning false’ is closed to new replies.