WordPress database products structure

To add product, you need to add

  • an entry in posts table, with post_type="product", post_title="product_name", post_excerpt="product_description". This will give you the post ID.
    • with the post ID, you will be able to add meta datas in the post_metas table._product_type, _visibility, _price, _sale_price….
    • use terms tables to add category related to the product

You can see all product metas (with get_post_meta() ) to learn more about all the needed one and their real names.

Ok, you want to do it with sql request, but you can also import products with a csv file or with the woocommerce Api, functions, class and dedicated method can make it easier to define the right sql request.

Hope it gives you some hints.

File not found.