This is my code:
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 +
function woo_custom_cart_button_text( $text ) {
if( has_term( 'liners', 'product_cat' ) ){
$text = __( ' ', 'your-plugin' );
echo do_shortcode('<a href="#" class="popmake-923">Request а Quote</a>');
}
return $text;
}
I need to make function to replace the "Add to cart" button Url and Text for just one specific product category.
This button will trigger a Lightbox with a contact form and the text for this button will be: Request a Quote.
How can I make it work as expected?
Here is how it works actually on this link.
Updated: for 2 different product categories (2 different buttons)
A global and complete solution for your products from 'liners' product category:
Here is that code:
Code goes in function.php file of your active child theme (or theme) or also in any plugin file.
This code is tested and works for all product types (simple, variable…). You will get (example):