I would like to replace the 'Add to cart' button for a specific product category and when product type isa a 'simple product'
.
I would like to do that on the page where I can see all the products (shop and archive pages) and in single product pages.
The code bellow just hide my add-to cart buttons from all post of my product category:
function western_custom_buy_buttons(){
$product = get_product();
if ( has_term( 'categ1', 'product_cat') ){
// removing the purchase buttons
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
remove_action( 'woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30 );
remove_action( 'woocommerce_external_add_to_cart', 'woocommerce_external_add_to_cart', 30 );
}
}
add_action( 'wp', 'western_custom_buy_buttons' );
How can I achieve that? Any help please.