• Resolved webartist00

    (@webartist00)


    Hi there,

    we want to connect a custom programmed filter with the woocommerce products in the shop. Sadly we cannot find the woocommerce product table (Product_img,Product_description…) in our phpMyAdmin Database. Can please provide us the path or an introduction how to find the table?

    Best regards,

    Thomas

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kaavya Iyer

    (@kaavyaiyer)

    Hi @webartist00,

    Top-level information for WooCommerce products is stored primarily in the wp_posts table in the WordPress database. The post_type for a product is ‘product’ or ‘product_variation’.

    SELECT * FROM wp_posts WHERE post_type = 'product'

    Product data is also stored in a few other tables and you can learn more about it here.

    To retrieve a product image:

    You will first need to get the post_id for the product from the wp_posts table using the above query. Now, use the post_id to get the meta value for the _thumbnail_id meta key.

    SELECT * FROM wp_postmeta WHERE post_id = '<post_id for product from wp_posts>'

    You then use the _thumbnail_id value to get the attached product image info:

    SELECT * FROM wp_postmeta WHERE meta_key = '_wp_attached_file' and post_id = '<_thumbnail_id meta value>'

    I hope this helps!

    Amir A. (woo-hc)

    (@amiralifarooq)

    Hi @webartist00
    I can see @kaavyaiyer Already explained you in detail. Furthermore, you can read this article on how WooCommerce database schema work.

    Thanks!

    Kaavya Iyer

    (@kaavyaiyer)

    Hi @webartist00,

    I just wanted to clarify a couple of things.

    It is not recommended to execute queries directly through the code. WooCommerce already provides a list of methods that can be used to retrieve product information. You can read more about here.

    For custom queries, you should make use of the wpdb class.

    If you can let me know what your use-case is, I can provide you with specific suggestions to go about it.

    I hope this helps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot find Products in PhpMyAdmin’ is closed to new replies.