Support » Plugin: Variation Swatches for WooCommerce » Not working with Ajax Calls

  • Resolved mhogas

    (@mhogas)


    Hey guys,

    This latest update broke some ajax calls and noticed this change in functions.php in wvs_variation_attribute_options_html :

    if ( is_ajax() && is_admin() ) {
      return $html;
    }
    

    Will this be going to remain the same? Not exactly sure why you prevented Ajax calls. It’s useful for example in a Quickview popup.

    From looking at the changelog, saw “Fix: WooCommerce Product bundle Issue”. Sould this code solve this? If so, i’m suggesting hooking into the default_wvs_variation_attribute_options_html filter and run a check to get the action and prevent only in that case, for example:

    
    add_filter('default_wvs_variation_attribute_options_html', function ($status){
    
    	if( is_ajax() && isset($_REQUEST['action']) && $_REQUEST['action'] === 'ajax_action_that_needs_to_be_prevented' ){
    		return true;
    	}
    
    	return $status;
    
    }, 10);
    

    Thanks, looking forward in your reply!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Not working with Ajax Calls’ is closed to new replies.