Hi,
I’ve got many issues with variations swatches.
– I would like to hide clear button (because there’s always something selected)
– I would like to hide also label button (like size, color etc. to make it more minimalist)
– Most of all : I don’t want a quantity box
– Most of all all : I’ve entered this code (see text under) in function.php so that price goes in add to cart button, it works perfectly for shop page but not for single product page 😭 :
add_filter( ‘woocommerce_product_add_to_cart_text’, ‘custom_add_to_cart_price’, 20, 2 ); // Shop and other archives pages
add_filter( ‘woocommerce_product_single_add_to_cart_text’, ‘custom_add_to_cart_price’, 20, 2 ); // Single product pages
function custom_add_to_cart_price( $button_text, $product ) {
// Variable products
if( $product->is_type(‘variable’) ) {
// shop and archives
if( ! is_product() ){
$product_price = wc_price( wc_get_price_to_display( $product, array( ‘price’ => $product->get_variation_price() ) ) );
return $button_text . ‘ – ‘ . strip_tags( $product_price );
}
// Single product pages
else {
return $button_text;
}
}
// All other product types
else {
$product_price = wc_price( wc_get_price_to_display( $product ) );
return $button_text . ‘ – ‘ . strip_tags( $product_price );
}
}
Thanks for your help 🙏🏽
Have a nice day,
Take care,
Deborah