title: How do categories and subcategories for WooCommerce are saved in DB?
body: <p>I have a problem with categories and subcategories in WordPress plugin - WooCommerce.
  I'm creating a script which would create a categories and subcategories, the problem is that I don't fully understand how all this works in WooCommerce DB structure.</p>
  
  <p>That's what I was able to do:</p>
  
  <p>In "wp_terms":</p>
  
  <pre><code>term_id | name              | slug     | term group
  20      | Parent category   | parent   | 0
  21      | Children category | children | 0
  </code></pre>
  
  <p>In "wp_term_taxonomy":</p>
  
  <pre><code>term_taxonomy_id | term_id | taxonomy    | description | parent | count
  1                | 20      | product_cat |             | 0      | 0
  2                | 21      | product_cat |             | 20     | 0
  </code></pre>
  
  <p>And that's working, but why the hell this don't:</p>
  
  <p>In "wp_term_taxonomy":</p>
  
  <pre><code>term_taxonomy_id | term_id | taxonomy    | description | parent | count
  1                | 20      | product_cat |             | 21     | 0
  2                | 21      | product_cat |             | 0      | 0
  </code></pre>