Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AshlinRejo/6a2f0320d0baa30dcb2cb148f2b6ce71 to your computer and use it in GitHub Desktop.
Save AshlinRejo/6a2f0320d0baa30dcb2cb148f2b6ce71 to your computer and use it in GitHub Desktop.
Discount rules v2: Change the dynamic strikeout class target
add_filter('advanced_woo_discount_rules_custom_target_for_simple_product_on_qty_update', function ($target){
$target = 'div.product div.price';
return $target;
}, 10);
@EmielZuurbier
Copy link

Hi Ashlin and thank you for your snippet.
In combination with your other snippet to replace site_main.js and a small tweak to the snippet above, I've managed to get the desired result.

add_filter('advanced_woo_discount_rules_custom_target_for_simple_product_on_qty_update', function ($target) {
    $target = 'p.price';
    return $target;
}, 10);

Your modified site_main.js script first searches in the form, but it needs to search for p.price directly as div.product is a parent of the form.

Thank you for all your time and effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment