WooCommerce: Finding the products in database

前端 未结 4 1048
小蘑菇
小蘑菇 2020-12-04 10:41

I\'m creating a website using WooCommerce and I want to restrict the available products to users depending on the postcode that they enter in the search form on my home page

4条回答
  •  广开言路
    2020-12-04 11:00

    The following tables are store WooCommerce products database :

    • wp_posts -

      The core of the WordPress data is the posts. It is stored a post_type like product or variable_product.

    • wp_postmeta-

      Each post features information called the meta data and it is stored in the wp_postmeta. Some plugins may add their own information to this table like WooCommerce plugin store product_id of product in wp_postmeta table.

    Product categories, subcategories stored in this table :

    • wp_terms
    • wp_termmeta
    • wp_term_taxonomy
    • wp_term_relationships
    • wp_woocommerce_termmeta

    following Query Return a list of product categories

    SELECT wp_terms.* 
        FROM wp_terms 
        LEFT JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
        WHERE wp_term_taxonomy.taxonomy = 'product_cat';
    

    for more reference -

    • Database Description
    • Fetch the Products of Woocommerce from it’s Table in Database

提交回复
热议问题