Advanced Dynamic Pricing For WooCommerce

Germanized for WooCommerce, by Vendidero

Germanized for WooCommerce by Vendidero is a widely used plugin that adapts WooCommerce stores for the German market — adding unit prices, legal notices, tax display requirements, and other regulatory features mandated by German e-commerce law. Because both Germanized and Advanced Dynamic Pricing for WooCommerce deeply modify how product prices are calculated and displayed, using them together requires a small amount of additional setup to prevent unit price conflicts and ensure legally consistent price display across product pages, cart, checkout, and order history.

This article covers all required settings and the full compatibility code snippet needed to make both plugins work correctly together.


Required Settings Before Adding the Code

Two plugin settings must be configured correctly before applying the compatibility code. Skipping either of these will cause the snippet to have no effect or produce unexpected behaviour.

In Advanced Dynamic Pricing → Settings → Calculation:

SettingRequired value
Use prices modified by other plugins✅ Must be ON

In Advanced Dynamic Pricing → Settings → System:

SettingRequired value
Suppress other pricing plugins in frontend❌ Must be OFF

⚠️ Both settings must be changed before saving. The code snippet will not function correctly without them.


Code Sample

Once the settings above are configured, add the following compatibility snippet to your child theme’s functions.php or the Code Snippets plugin:

 Code Explained (for Developers)

The snippet addresses five distinct compatibility issues between Germanized and Advanced Dynamic Pricing. Each fix targets a specific point in the price calculation and display pipeline.


Fix 1 — Unit price display in cart with one-item discounts

ElementDescription
wdp_before_apply_to_wc_cartAn Advanced Dynamic Pricing action that fires just before the plugin applies its calculated prices to the WooCommerce cart object.
remove_filter(..., 'wc_gzd_cart_product_unit_price', 0)Removes Germanized’s unit price filter from its default priority of 0 — the earliest possible position — where it would read the price before ADP has finished modifying it.
add_filter(..., 'wc_gzd_cart_product_unit_price', 100, 3)Re-registers the same Germanized function at priority 100, ensuring it runs after Advanced Dynamic Pricing has applied its discounts to the cart. This fixes single-item discount scenarios where the unit price was incorrectly showing the pre-discount value.

Fix 2 — Recalculate unit price before it is read

ElementDescription
woocommerce_gzd_before_get_unit_priceA Germanized action that fires just before the unit price is retrieved for a product.
$product->recalculate_unit_price()Forces Germanized to recompute the unit price from scratch using the current product price — which at this point includes any modifications made by Advanced Dynamic Pricing — rather than relying on a previously cached value.

Fix 3 — Ensure unit price reflects the dynamically discounted price

ElementDescription
woocommerce_gzd_get_unit_price_rawA Germanized filter that provides the raw (unformatted) unit price value for a product. This is the source value used to render the legal unit price display (e.g. “€2.50 / 100ml”).
$product->wdp_original_priceA property set by Advanced Dynamic Pricing on the product object when a pricing rule has been applied. Its presence indicates the product’s price has been dynamically modified.
Branch 1 — ADP rule appliedIf wdp_original_price is set and is higher than the current price, the product has been discounted. recalculate_unit_price() is called with the current (discounted) price to update the unit price accordingly.
Branch 2 — No ADP rule, native WooCommerce saleIf no ADP rule is active but the product is on sale via WooCommerce’s native sale price, the unit price is recalculated using get_sale_price() — but only outside the cart and checkout, where Germanized handles unit prices differently.

Fix 4 — Pass discounted price to Germanized product in cart

ElementDescription
woocommerce_cart_item_productA WooCommerce filter that provides the product object for each item in the cart. Returning a modified object here affects all subsequent price and label rendering for that cart item.
$cart_item['wdp_original_price']Advanced Dynamic Pricing stores the original pre-discount price in the cart item data under this key. Its presence confirms the item has been discounted by the plugin.
$product->gzd_productGermanized extends each WooCommerce product with a gzd_product wrapper object (WC_GZD_Product) that handles unit price and legal notice rendering.
$product->gzd_product->wdp_original_priceSets the original price on the Germanized product wrapper so Fix 3’s logic can access it correctly when called in the cart context.
get_wc_product()->set_price(...)Pushes the current discounted price into the underlying WC_Product object that Germanized wraps, ensuring its unit price calculations are based on the correct discounted value.

Fix 5 — Correct unit price in order history and order emails

ElementDescription
woocommerce_gzd_order_item_unit_priceA Germanized filter that controls the rendered unit price HTML for each line item in the order view (order confirmation page, admin order screen, and order emails).
$item->legacy_values['data']The WooCommerce order item’s stored product snapshot, saved at the time the order was placed. Contains the actual WC_Product object with the price that was paid.
get_wc_product()->set_price(...)Updates the Germanized product wrapper with the price from the stored order item snapshot, ensuring the unit price shown in order history reflects what the customer actually paid — not the current live product price.
$gzd_product->get_unit_html( false )Regenerates the unit price HTML string using the now-corrected price. The false argument suppresses HTML escaping for direct output.

What Issues Does This Fix?

Without this compatibility code, the following problems may occur when using both plugins simultaneously:

IssueFixed by
Unit price in cart shows pre-discount price instead of discounted priceFix 1 + Fix 2 + Fix 3
Unit price on product page not updating after ADP rule appliesFix 2 + Fix 3
Germanized unit price in cart doesn’t reflect one-item discount rulesFix 1
Unit price in order confirmation / order emails shows wrong valueFix 5
Cart item unit price out of sync with dynamically discounted item priceFix 4

How to Apply This Code

  1. Open Advanced Dynamic Pricing → Settings → Calculation and set “Use prices modified by other plugins” to ON.
  2. Open Advanced Dynamic Pricing → Settings → System and set “Suppress other pricing plugins in frontend” to OFF.
  3. Save both settings pages.
  4. Open Appearance → Theme File Editor or the Code Snippets plugin.
  5. Paste the full snippet into your child theme’s functions.php or a dedicated snippet.
  6. Save and test the following pages with an active discount rule:

⚠️ Always use a child theme or Code Snippets — editing the parent theme’s functions.php directly will be overwritten on theme updates.


When Should You Use This?

You are legally required to display accurate per-unit pricing and need it to stay consistent with dynamically applied discounts.

You run a German-market WooCommerce store using Germanized for WooCommerce and want to apply dynamic pricing rules via Advanced Dynamic Pricing.

The unit price (Grundpreis) displayed in the cart or on product pages is showing the original price instead of the discounted one.

Unit prices in order confirmation emails or order history do not reflect the discount applied at the time of purchase.

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