Have you filled in your short descriptions in WooCommerce just to discover that the Add to Cart button gets pushed down below the fold? Well let’s solve that right now shall we?

WooCommerce has some excellent features and then there’s some that can be a bit confusing if you just want to move something around on the screen. Fortunately, the priority of actions can be sorted so that they are added to the page in a different order. By default, the add to cart button code has a priority of 30, whereas the short description (or excerpt) has a priority of 20.

The code below can be added to your theme’s functions.php file to change the priority of the add to cart code, thus moving it above the excerpt.

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);

There, wasn’t that easy? You can also change the priority of the other parts of this page to re-order anything you like. The available actions to change are

woocommerce_template_single_title - 5
woocommerce_template_single_price - 10
woocommerce_template_single_excerpt - 20
woocommerce_template_single_add_to_cart - 30
woocommerce_template_single_meta - 40
woocommerce_template_single_sharing - 50

Hopefully you’re back on course now. More tips like this to come soon!