All the data like different prices of a product custom post type are store (for each product) in postmeta table.
To find the post id of all products you have to use this query on posts table:
SELECT * FROM 'posts' WHERE 'post_type' = 'product'
For each product id (post_id
), you can retrieve all related data with this query on postmeta table:
SELECT * FROM 'postmeta' WHERE 'post_id' = nnnn
(nnnn is the number id (post_id
) of a product)
You will get the list of all product properties metakey
and metavalues
.
For related price meta_key
(s) you have, for example:
- _regular_price
- _sale_price
- _price
- …
To get a particular value of a product meta_key, you can use the wordpress function:
get_post_meta($post_id, '$meta_key');
post_type
isproduct
. For eachpost_id
(product id) you can find all related data to this product in postmeta table:SELECT * FROM 'postmeta' WHERE 'post_id' = nnnn
(nnnn is the number ID of one product). All the different prices for each product are store in "postmeta" table.