How to reorder WooCommerce’s single product template

We can see that, for example, the ‘woocommerce_single_product_summary’ hook includes the code that generates the product title, price, add-to-cart and meta (category and tags), amongst others.

Notice the numbers

<span class="token comment" spellcheck="true">/**
  * woocommerce_single_product_summary hook
  *
  * @hooked woocommerce_template_single_title - 5
  * @hooked woocommerce_template_single_rating - 10
  * @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
  */</span>
  <span class="token function">do_action</span><span class="token punctuation">(</span> <span class="token string">'woocommerce_single_product_summary'</span> <span class="token punctuation">)</span><span class="token punctuation">;</span>

Each number is an order positon inside the hook. The lower the number, the earlier it appears in the layout.

<span class="token comment" spellcheck="true">// Add product meta in new position</span>
<span class="token function">add_action</span><span class="token punctuation">(</span> <span class="token string">'woocommerce_single_product_summary'</span><span class="token punctuation">,</span> <span class="token string">'woocommerce_template_single_meta'</span><span class="token punctuation">,</span> <span class="token number">5</span> <span class="token punctuation">)</span><span class="token punctuation">;</span>

Keeping WordPress Under [Version] Control with Git

My default .gitignore file looks something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Exclude these files from the git repo
wp-content/backup/*
wp-content/cache/*
wp-content/upgrade/*
wp-content/uploads/*
sitemap.*
wp-config.php
# Hidden system files
*.DS_Store
*[Tt]humbs.db
*.Trashes
# Include these files in previously blocked directories
!wp-content/uploads/.htaccess