Skip to main content

Yith Request a Quote Plugin Bug

Introduction

Follow this step if the add to cart button should say Add to Quote, but when it loads over ajax they say Add to Cart.

The Problem: No Hook

The reason why this error occurs is that the Yith hook is not added to “woocommerce_after_shop_loop_item” action on ajax.

The Solution: Add The Hook

Add the following code to your functions.php in your child theme or use a PHP code inject plugin.

if ( !function_exists( 'yit_raq_button_ajax' ) ) {
function yit_raq_button_ajax() {
if ( function_exists('YITH_Request_Quote_Premium')
&& defined('DOING_AJAX')
&& DOING_AJAX
&& isset( $_REQUEST['action'] )
&& 'divi_filter_ajax_handler' === $_REQUEST['action']
) {
require_once( YITH_YWRAQ_INC . 'class.yith-ywraq-shortcodes.php' );
require_once( YITH_YWRAQ_INC . 'class.yith-request-quote-frontend.php' );
YITH_Request_Quote_Premium();
add_action('woocommerce_after_shop_loop_item', array( YITH_Request_Quote_Premium(), 'add_button_shop'));
add_filter( 'woocommerce_loop_add_to_cart_link', array( YITH_YWRAQ_Frontend(), 'hide_add_to_cart_loop' ), 99, 2 );
}
}
add_action('init','yit_raq_button_ajax');
}