skip to Main Content

I’ve been inspecting woocommerce database scheme, most of the details make sense except i can’t seem to find in which table the attribute title is stored. The sample product in the image has different selections for product colour , i can see the attribute coulour values from the database , but i can’t seem to find where the colour attribute tittle gets stored , look at the red arrow to see the detail am asking about.

2

Answers


    1. The entire attribute category is stored in ‘wp_term_taxonomy’ table
      with a prefix ‘pa_’.
      enter image description here
    2. The entire attribute’s value is stored in ‘wp_terms’ table with
      their name and slug. To link the attributes to the product
      Woocommerce use ‘wp_term_relationships’ table to store the mapping
      of the post/product ID with the term ID.

    enter image description here

    1. Lastly, WooCommerce keep all the assigned attribute name as a
      serialized way in ‘wp_postmeta’ table under meta_key =>
      _product_attributes.
      enter image description here

    So to resume: Attributes names are displayed from ‘_product_attributes’ meta_key and the values are displayed from ‘wp_terms.name’.

    It’s all in the database but I don’t recommend accessing the data directly from the database, use the built-in functions instead.

    Login or Signup to reply.
  1. Product attributes are one of the not-so-nice-things in WooCommerce. They look like a taxonomy, but aren’t.

    The attributes name is stored in wp_woocommerce_attribute_taxonomies

    You may have a look into WooCommerce’ documentation to find filters for attributes: https://woocommerce.github.io/code-reference/hooks/hooks.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search