Home Forums WoodMart support forum Price “from” (dynamic discount)

Price “from” (dynamic discount)

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #589131

    DEVPOM1234
    Participant

    Hello,

    The product price “from” show the normal price not the best price from the dynamic discount (see in attachment.
    On my exemple the best price is 2,40€ but it’s appear 3,20€.

    Attachments:
    You must be logged in to view attached files.
    #589280

    Hello,

    Sorry to hear about the inconvenience. Kindly, please share your Site WP-ADMIN Login details in the Private Content field so that we can check this concern on your Site and help you out accordingly.

    Best Regards

    #589289

    DEVPOM1234
    Participant

    Find in private :
    The website is in production so don’t make a mistake

    #589426

    Hello,

    Yes, it is the theme’s default functionality. It always shows the product’s normal price which you have added in the price field: https://postimg.cc/NL8k78sc

    It will not show the price from the Dynamic discount table.

    Best Regards.

    #589481

    DEVPOM1234
    Participant

    Hello,

    Thank you, how we can do for have the best price from Dynamic discount table.
    Because the customer see this price and is wrong

    #589513

    DEVPOM1234
    Participant

    What do you think of this code for show the lower price if there is a best price in dynamic discount :

    
    add_filter('woocommerce_get_price_html', 'apply_dynamic_discount_price', 100, 2);
    function apply_dynamic_discount_price($price, $product) {
        // Vérifiez si $data est défini globalement ou essayez de l'initialiser ici
        global $data;
    
        // Si $data n'est pas vide, essayez de trouver le prix le plus bas
        if (!empty($data)) {
            $lowest_price = null;
            foreach ($data as $id => $row) {
                if (is_null($lowest_price) || $row['price'] < $lowest_price) {
                    $lowest_price = $row['price'];
                }
            }
    
            // Si un prix plus bas est trouvé, le remplacer par le prix par défaut
            if ($lowest_price) {
                $price = wc_price($lowest_price);
            }
        }
    
        return $price;
    }
    #589585

    Hello,

    You can try the code in the child theme’s function.php file if it works for you please let us know.

    Best Regards.

    #589857

    DEVPOM1234
    Participant

    Hello,

    Unfortunately, it doesn’t works.

    #589866

    Hello,

    Then please hire a developer to do this for you. As I already told you that there is no option in Theme Settings available for that.

    It requires customizations and this is beyond our limitations and support policy.

    Regards.
    Xtemos Studios

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