Title: Wrong variable product badge value
Last modified: December 11, 2024

---

# Wrong variable product badge value

 *  Resolved [Defix](https://wordpress.org/support/users/defix/)
 * (@defix)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/)
 * Displays the discount percentage value 0% for variable products badge instead
   of the actual discount.
   And some cases its not even displays nothing, even not
   value “0%”Using Blocksy theme.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18191526)
 * hello
 * Please, try 1st code from page [https://docs.algolplus.com/algol_pricing/compatibility-with-themes/](https://docs.algolplus.com/algol_pricing/compatibility-with-themes/)
 * Add it to functions.php or use Code Snippets plugin
 *  Thread Starter [Defix](https://wordpress.org/support/users/defix/)
 * (@defix)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18191565)
 * Thanks!
   Using that last php snippet and mainly now fixed in product catalog, 
   but if I using woocommerce shortcodes to display products on my frontpage etc–
   there still that problem exist.. How to fix that?
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18191592)
 * please share your shortcode
 *  Thread Starter [Defix](https://wordpress.org/support/users/defix/)
 * (@defix)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18192433)
 * [products limit=”4″ columns=”4″ category=”furniture” visibility=”featured”]
 * Maybe something related _visibility=”featured”_
 *  Plugin Support [thisisirene](https://wordpress.org/support/users/thisisirene/)
 * (@thisisirene)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18193823)
 * Good day, [@defix](https://wordpress.org/support/users/defix/)!
 * Are you using any page builders plugin (Elementor, e.g.)? Because there’s no 
   problem in variable badges with [the custom sale badge settings](https://snipboard.io/sQgyGx.jpg)
   and the compatibility code on the page with your shortcode.
 *  Thread Starter [Defix](https://wordpress.org/support/users/defix/)
 * (@defix)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18196194)
 * Hi!
   No page builders. Using Blocksy pro and Stackable blocks. Woocommerce archive
   and singe products pages ok, but not working with that shortcode, if product 
   is **varable **product.
 * TAke a look – Woo and ADP activated on site:
   [https://staging.muster.ee/](https://staging.muster.ee/)
    -  This reply was modified 1 year, 5 months ago by [Defix](https://wordpress.org/support/users/defix/).
    -  This reply was modified 1 year, 5 months ago by [Defix](https://wordpress.org/support/users/defix/).
 *  Plugin Support [thisisirene](https://wordpress.org/support/users/thisisirene/)
 * (@thisisirene)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18196559)
 * Hi, [@defix](https://wordpress.org/support/users/defix/)!
 * Could you, please, send us our JSON system report (Pricing rules>Tools>System
   report>Get system report)[ via our help desk](https://algolplus.freshdesk.com/support/tickets/new)?
 *  Thread Starter [Defix](https://wordpress.org/support/users/defix/)
 * (@defix)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18196663)
 * Hi, JSON sended.
 *  Plugin Author [algol.plus](https://wordpress.org/support/users/algolplus/)
 * (@algolplus)
 * [1 year, 4 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18244520)
 * Final code for whom having same problem
 *     ```wp-block-code
       add_filter('woocommerce_variation_prices', function ($prices_array, $product, $for_display) {    global $post;    if (        !is_shop() &&        !is_product_category() &&        !is_product() &&        !is_product_taxonomy() &&        !(isset($post) && $post->post_type === 'product')    ) {        return $prices_array;    }    $processedProduct = adp_functions()->calculateProduct($product, 1);    if (!$processedProduct instanceof \ADP\BaseVersion\Includes\PriceDisplay\ProcessedVariableProduct) {        return $prices_array;    }    $new_prices_array = array("price" => [], "regular_price" => [], "sale_price" => []);    foreach ($processedProduct->getChildren() as $variation) {        $idx = $variation->getProduct()->get_id();        $new_prices_array['price'][$idx] = $variation->getPrice();        $new_prices_array['sale_price'][$idx] = $variation->getPrice();        $new_prices_array['regular_price'][$idx] = $variation->getOriginalPrice();    }    return $new_prices_array;}, 10, 3);
       ```
   

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Wrong variable product badge value’ is closed to new replies.

 * ![](https://ps.w.org/advanced-dynamic-pricing-for-woocommerce/assets/icon-256x256.
   png?rev=1984204)
 * [Advanced Dynamic Pricing and Discount Rules for WooCommerce](https://wordpress.org/plugins/advanced-dynamic-pricing-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-dynamic-pricing-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-dynamic-pricing-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-dynamic-pricing-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-dynamic-pricing-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-dynamic-pricing-for-woocommerce/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [algol.plus](https://wordpress.org/support/users/algolplus/)
 * Last activity: [1 year, 4 months ago](https://wordpress.org/support/topic/wrong-variable-product-badge-value/#post-18244520)
 * Status: resolved