Skip to content Skip to sidebar

Resolved by author

Resolved in: 4.26.0

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 ) ) );
    }