We have a requirement to show product variations on all product tiles, in
all views. I have some code to add to functions.php that does the trick
for the shop page but we also have several pages that are loaded through
the infinite scroll functionality and products delivered through this
method are showing the “select options” button we previously removed.
This is also the case for carousel items, my code is below – any
pointers to how I might achieve this would be much appreciated.
add_action( 'woocommerce_before_shop_loop', 'pn_select_variations' );
function pn_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 );
}