Passer au contenu Passer à la barre latérale

Waiting for author

Topic Tags: Compatibility, WCML

Overview of the issue

When using YITH WooCommerce Dynamic Pricing & Discounts Premium with WPML and multi-currency enabled, AJAX actions may trigger incorrect behavior: gifts are not added to the cart in secondary currencies, and cart prices revert to the default currency.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Add the following code to your theme’s functions.php file.
    // WPML Workaround for compsupp-8147 
    add_filter( 'wcml_load_multi_currency_in_ajax', 'add_action_to_multi_currency_ajax', 10, 1 );
    
    function add_action_to_multi_currency_ajax( $ajax_actions ) {
        $ywdpd_actions = array(
            'ywdpd_add_gift_to_cart',
            'ywdpd_add_bogo_to_cart',
            'ywdpd_add_special_to_cart',
            'ywdpd_add_last_deals',
            'ywdpd_check_variable',
            'ywdpd_valid_rule_in_checkout',
            'ywdpd_update_cart_after_payment_method',
        );
    
        return array_values( array_unique( array_merge( (array) $ajax_actions, $ywdpd_actions ) ) );
    }
            

Laisser une réponse

Veuillez rester sur le sujet et être respectueux envers les autres. Si vous avez besoin d'aide pour des problèmes non liés à ce message, utilisez notre Forum de Support pour démarrer une discussion ou soumettre un ticket.

Vous pouvez utiliser ces balises :
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>