• Resolved Defix

    (@defix)


    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

    (@algolplus)

    hello

    Please, try 1st code from page https://docs.algolplus.com/algol_pricing/compatibility-with-themes/

    Add it to functions.php or use Code Snippets plugin

    Thread Starter Defix

    (@defix)

    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

    (@algolplus)

    please share your shortcode

    Thread Starter Defix

    (@defix)

    [products limit=”4″ columns=”4″ category=”furniture” visibility=”featured”]

    Maybe something related visibility=”featured”

    Plugin Support thisisirene

    (@thisisirene)

    Good day, @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 and the compatibility code on the page with your shortcode.

    Thread Starter Defix

    (@defix)

    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/

    • This reply was modified 3 months, 1 week ago by Defix.
    • This reply was modified 3 months, 1 week ago by Defix.
    Plugin Support thisisirene

    (@thisisirene)

    Hi, @defix!

    Could you, please, send us our JSON system report (Pricing rules>Tools>System report>Get system report) via our help desk?

    Thread Starter Defix

    (@defix)

    Hi, JSON sended.

    Plugin Author algol.plus

    (@algolplus)

    Final code for whom having same problem

    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)
  • You must be logged in to reply to this topic.