Перейти к содержимому Перейти к боковой панели

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

Оставить ответ

Пожалуйста, придерживайтесь темы и уважайте других. Если вам нужна помощь по вопросам, не связанным с этим сообщением, используйте наш Форум поддержки, чтобы начать чат или отправить заявку.

Вы можете использовать эти теги:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>