I am trying to use this block of code to add variations to my product page but when I do it causes mulitiple add to cart buttons under my products after add to cart has been selected. Is there a way to set the code to reset the variable product to "Choose a selection" after a product has been added to the cart?
if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
function woocommerce_template_loop_add_to_cart() {
global $product;
if ($product->product_type == "variable" && (is_product() || is_product_category() || is_product_tag())) {
woocommerce_variable_add_to_cart();
}
else {
woocommerce_get_template( 'loop/add-to-cart.php' );
}
}
}