Hi
I want to show just the colour variation on shop page for variable products. I have been able to find the code below online which adds the product variation onto the shop page neatly.
add_action( 'woocommerce_before_shop_loop', 'handsome_bearded_guy_select_variations' );
function handsome_bearded_guy_select_variations() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 30 );
}
My issue with this code is that:
1. It seems to be adding the add to cart button on both variable and simple products
2. I want to show only the colour variation not all the variations.
Any help will be appreciated.
Hey adotopanuga,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
Basilis