Skip to content

Instantly share code, notes, and snippets.

@eder-dias
Created May 20, 2017 19:31
Show Gist options
  • Save eder-dias/5817b9dd76f3405b64824ae0cbe34f50 to your computer and use it in GitHub Desktop.
Save eder-dias/5817b9dd76f3405b64824ae0cbe34f50 to your computer and use it in GitHub Desktop.
Move add to cart button above the description [Woocommerce]
/**
* woocommerce_single_product_summary hook
*
* @hooked woocommerce_template_single_title - 5
* @hooked woocommerce_template_single_price - 10
* @hooked woocommerce_template_single_excerpt - 20
* @hooked woocommerce_template_single_add_to_cart - 30
* @hooked woocommerce_template_single_meta - 40
* @hooked woocommerce_template_single_sharing - 50
*/
remove_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30);
add_action('woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 15);
@marcomarsala
Copy link

It works.

@mrrajsoni
Copy link

Awesome. Works like a charm.

@crossbg1
Copy link

Awesome - it works.

Thank you!

@itsgrahamfoster
Copy link

Brilliant, ta!

@bodeebones
Copy link

Can you show this for Storefront by Woo, its not the same as this

@johnalexthuo
Copy link

perfect

@pawsey18
Copy link

pawsey18 commented Jan 5, 2019

Didn't work for me. One gets added to the top and the bottom one doesn't get removed.

@jessicamullen
Copy link

it works, thanks!

@mitchellkrogza
Copy link

I cannot get this to work on variable products. Can anyone help its driving me mad now. I need it above the variation description not the short description
2019-12-29_15-20

@mikkel-ol
Copy link

Elegant, thanks!

@JGWINBUSH
Copy link

Thank you for sharing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment