Advanced Dynamic Pricing For WooCommerce

SUMO Reward Points, by Fantastic Plugins

SUMO Reward Points by Fantastic Plugins adds a loyalty rewards system to WooCommerce, letting customers earn and redeem points on purchases. To calculate how many points a product earns, SUMO hooks into woocommerce_get_price_html and reads the displayed product price. The conflict with Advanced Dynamic Pricing for WooCommerce appears when no active pricing rule targets a product — in that case Advanced Dynamic Pricing still modifies the price HTML output through its own filters, and SUMO reads that modified value incorrectly, producing wrong reward point calculations for products that carry no discount.

This article provides a one-filter fix that tells Advanced Dynamic Pricing to step aside and let WooCommerce render the native price HTML for any product where no pricing rule currently applies.


Required Settings Before Adding the Code

Before applying the snippet, confirm these two Advanced Dynamic Pricing settings are correct.

Go to Advanced Dynamic Pricing → Settings → Calculation and turn “Use prices modified by other plugins” to ON. Then go to Advanced Dynamic Pricing → Settings → System and turn “Suppress other pricing plugins in frontend” to OFF. Save both pages before continuing.


Code Sample

Add the following snippet to your child theme’s functions.php or the Code Snippets plugin:

 Code Explained (for Developers)

ElementDescription
wdp_price_display_htmlAn Advanced Dynamic Pricing filter that controls the final price HTML string the plugin outputs for a product. Returning a different value here overrides whatever the plugin would normally display.
$price_htmlThe price HTML string Advanced Dynamic Pricing has prepared for this product — potentially a modified version even when no discount rule applies.
$wdp_productAdvanced Dynamic Pricing’s internal processed product object, wrapping the underlying WC_Product and exposing methods to check whether rules fired for this product.
$wdp_product->are_rules_applied()Returns true if at least one Active Dynamic Pricing rule currently targets this product. When it returns false, no discount applies — and this is exactly the scenario where SUMO reads the wrong price HTML.
WDP_Frontend::process_without_hooks(...)An Advanced Dynamic Pricing utility method that calls a given callable while suppressing a specified list of filters. It temporarily removes the listed hooks, executes the callable, then restores the hooks — letting the callable run as if those filters never existed.
array( $wdp_product->get_wc_product(), 'get_price_html' )The callable to execute — get_price_html() on the native WC_Product object. This produces WooCommerce’s original, unmodified price HTML for the product.
array( 'woocommerce_get_price_html' )The list of filters to suppress during the call. Removing woocommerce_get_price_html prevents Advanced Dynamic Pricing’s own price HTML modifications from firing again inside the call, which would create a recursive loop.
return $price_htmlWhen a rule does apply (are_rules_applied() returns true), the filter returns the original $price_html unchanged — Advanced Dynamic Pricing’s modified price HTML displays normally for discounted products.
10, 2Hook priority 10; 2 tells WordPress the callback accepts both $price_html and $wdp_product.

Key concept: The fix targets only products with no active rule. Products carrying a discount display the Advanced Dynamic Pricing price HTML exactly as configured. Products with no active rule display WooCommerce’s native price HTML, which SUMO can read correctly to calculate reward points.


Why Does This Conflict Happen?

Advanced Dynamic Pricing registers itself on woocommerce_get_price_html and modifies the output for every product — even those with no active discount rule. SUMO Reward Points calls get_price_html() to determine the product’s current price for reward point calculation. When Advanced Dynamic Pricing intervenes on a product with no discount, it can produce an inconsistent price HTML that SUMO misreads, resulting in reward points that don’t match the actual product price.

The fix bypasses Advanced Dynamic Pricing’s HTML output selectively — only for unaffected products — so SUMO always gets a clean, unmodified price value to work with.


How to Apply This Code

  1. Go to Advanced Dynamic Pricing → Settings → Calculation and enable “Use prices modified by other plugins”. Save the page.
  2. Go to Advanced Dynamic Pricing → Settings → System and disable “Suppress other pricing plugins in frontend”. Save the page.
  3. Open Appearance → Theme File Editor in your WordPress admin, or open the Code Snippets plugin.
  4. Paste the snippet into your child theme’s functions.php or create a new dedicated snippet.
  5. Save the file or snippet.
  6. Visit a product page for a product with no active discount rule and verify the price displays correctly. Then check that the reward points preview SUMO shows next to that price reflects the correct amount.
  7. Also verify a product with an active discount rule still shows the discounted price and its reward points calculate correctly against the discounted value.

⚠️ Always use a child theme or Code Snippets rather than editing the parent theme’s functions.php directly — parent theme files get overwritten on theme updates.


When Should You Use This?

This fix applies when you notice SUMO Reward Points showing incorrect point values on products that carry no active pricing rule from Advanced Dynamic Pricing. The issue typically surfaces as reward points that look inflated, missing, or inconsistent with the displayed price — but only on products where no discount rule fires. If discounted products calculate reward points correctly but non-discounted ones don’t, this snippet resolves the conflict.

Have questions? Please submit a support request. We're always happy to help!

Advanced Dynamic Pricing
for WooCommerce
PRO

From $60
Buy
✓ 30-day money-back guarantee