Hi. How can we help?

Add to Quote button in Woocommerce Product Table of Barn2Media

Please add the following snippets to add to the functions.php file in your theme or child theme. Choose a snippet depending on whether you’re using YITH’s free or premium add to quote plugin.

Code snippet for free YITH WooCommerce Request a Quote plugin

if ( function_exists('YITH_YWRAQ_Frontend') && class_exists('WC_Product_Table_Plugin') ) {
 add_filter('wc_product_table_data_short_description','add_to_quote_button_in_table',99,2);
 function add_to_quote_button_in_table($short_description, $pid) {
 ob_start();
 YITH_YWRAQ_Frontend()->print_button( $pid );
 return ob_get_clean();
 }
}

Code snippet for premium version of the YITH plugin

if ( defined('YITH_YWRAQ_PREMIUM') && function_exists('YITH_YWRAQ_Frontend') && class_exists('WC_Product_Table_Plugin') ) {
 add_filter('wc_product_table_data_short_description','add_to_quote_button_in_table',99,2);
 function add_to_quote_button_in_table($short_description, $pid) {
 ob_start();
 YITH_YWRAQ_Frontend()->print_button( $pid );
 return ob_get_clean();
 }
}

These code snippets will replace the short description column in WooCommerce Product Table with the YITH add to quote button. If you want to use the short description column for something else then you can modify the code to hook into a different column of the product table.

 

Was this article helpful?
0 out of 0 found this helpful

Back to Help Center >