I am working on a custom theme. I need to move the add to cart button from the woocommerce_single_variation (variable.php) section into the woocommerce_after_single_product_summary (content-single-product.php) section.
I have been able to do this by adding the following to my functions.php file.
function remove_loop_button(){
remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 );
}
add_action('init','remove_loop_button');
add_action( 'woocommerce_after_single_product_summary', 'woocommerce_single_variation_add_to_cart_button', 30 );
However when I do this the button shows up but is not functional. Clicking on it just does nothing. Does anyone know is it possible to move the add to cart button in such a way? Please note this is for variable products not single so I'm thinking the behavior is different.
I appreciate any help that can be given. Thanks!