doshortcode via ajax not working
-
Hi, i’m using plugin YITH WooCommerce Compare for my theme. yith_compare_button doesn’t work in an AJAX request when called with:
add_action(“wp_ajax_sw_listing_ajax”, array($this, “sw_listing_ajax”));
add_action(“wp_ajax_nopriv_sw_listing_ajax”,array($this, “sw_listing_ajax”));
function sw_listing_ajax(){
if ( in_array( ‘yith-woocommerce-compare/init.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) || in_array( ‘yith-woocommerce-wishlist/init.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) ) {
if ( in_array( ‘yith-woocommerce-compare/init.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) ){ echo do_shortcode(‘[yith_compare_button]’);
}
if ( in_array( ‘yith-woocommerce-wishlist/init.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) ){ echo do_shortcode( “[yith_wcwl_add_to_wishlist]” ); }
}
}
With yith_wcwl_add_to_wishlist shortcode it’s working fine. But yith_compare_button doesn’t work.
Please help me now. Thanks alot!
- The topic ‘doshortcode via ajax not working’ is closed to new replies.