Support » Plugin: YITH WooCommerce Compare » Ajax error

  • hello, I am occupying a loop with filters (jetwoo filter) with ajax, when loading the page, the button [yith_compare_button] has no problems, but when clicking on some filter with ajax the button remains as text [yith_compare_button] bone it breaks, any solution?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Inger Garrido

    (@inger1988)

    hello, I am occupying a loop with filters (jetwoo filter) with ajax, when loading the page, the button [yith_compare_button] has no problems, but when clicking on some filter with ajax the button remains as text [yith_compare_button] bone it breaks, any solution?

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,

    the problem is that you need to reinit the compare button after a filter was apply. To do that you should ask to filter plugin author if their plugin rigger a js event that we can use to initialize the compare button.

    Let us know.

    Thread Starter Inger Garrido

    (@inger1988)

    good morning they answered me the following “The trigger is jet-filter-content-rendered, YITH guys can use that 🙂”

    Thread Starter Inger Garrido

    (@inger1988)

    Can it be solved with what was sent?

    Plugin Author YITHEMES

    (@yithemes)

    Hi,

    please could you provide with the URL the issue occurs in, so we’ll be able to check for that?

    Thread Starter Inger Garrido

    (@inger1988)

    https://clientesfreak.cl/demo/naturalbeauty/tienda/

    It is a page only for tests so the messy style, but that is the link

    Thread Starter Inger Garrido

    (@inger1988)

    Any solution?

    Plugin Author YITHEMES

    (@yithemes)

    Hi there,
    the problem is that when the ajax call is performed, our class YITH_Woocompare_Frontend is not loaded. so the shortcode can’t be rendered properly.

    Before to include that class we make some check.

     public function is_frontend() {
                $is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
    	        $context_check = isset( $_REQUEST['context'] ) && $_REQUEST['context'] == 'frontend';
    	        $actions_to_check = apply_filters( 'yith_woocompare_actions_to_check_frontend', array( 'woof_draw_products' ) );
    	        $action_check = isset( $_REQUEST['action'] ) && in_array( $_REQUEST['action'], $actions_to_check );
    
                return (bool) ( ! is_admin() || ( $is_ajax && ( $context_check || $action_check ) ) );
            }

    You should contact plugin developers and say them to use the hook ‘yith_woocompare_actions_to_check_frontend‘ to include their ajax action to the ones that our plugin check.

    We remain at your disposal.

    • This reply was modified 8 months, 3 weeks ago by YITHEMES.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Ajax error’ is closed to new replies.