Woocommerce how to remove Variation select list and show it in a custom hook

1.6k Views Asked by At

In a Woocommerce Product Page I need to remove the Variation Select Lists from the default placement and show them y my custom hook:

"flatsome_custom_single_product_3"

How can I do this?

I tried with this, but not working.

   remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 );
   add_action( 'flatsome_custom_single_product_3', 'woocommerce_single_variation', 10 );

Take a look at this capture to see what I mean:

enter image description here

1

There are 1 best solutions below

4
On

You could first remove the default variation and then add your own using the following hook:

remove_action('woocommerce_variable_add_to_cart', 'woocommerce_variable_add_to_cart', 30);

add_action('woocommerce_variable_add_to_cart', 'custom_variable_div', 15);

add_action('woocommerce_variable_add_to_cart', 'woocommerce_single_variation_add_to_cart_button', 20);

function custom_variable_div(){
    # Make up your own stuff
}

I've tested it and it works seamlessly fine!