In my current project I needed to know which fields are available for each product type. The list is below, hope it can be of use for your own project!

A word about post vs product type

In WooCommerce we have 2 main post types: “product” and “product_variation”. Post type “product” is used for all products that are visible on the category page such as simple, variable, grouped and external products. Post type “product_variation” is used for variations of a variable product and do not show on their own on the category page. Post types are core WP concepts and stored in the POSTS table. They can be used in WP_Query to filter which type of content is shown.

WooCommerce product types have 4 default types (more can be added by plugins): “simple”, “variable”, “external” and “grouped”. Product types are Woo fields; and stored in the POSTMETA table.

Explanation of Symbols
✅ = in use
❌ = not in use by this product type
⚠️ = see numbered notes
y = available but not used by WooCommerce product class

Post Fields

These fields are core WP and stored in the POSTS table. WooCommerce has its own Getter / Setter methods for retrieving and updating the fields, and these can differ from the column name in the database.

Database FieldWoo Get / Set KeySimpleVariableVariationGroupedExternal
idid
post_authoryyyyy
post_dateyyyyy
post_date_gmtdate_created 2y
post_contentdescription[empty]
post_titlename⚠️ 1
post_excerptshort_description⚠️ 1
post_statusstatus⚠️ 4
comment_statusreviews_allowedy
ping_statusyyyyy
post_passwordpost_passwordy
post_nameslug⚠️ 1
to_pingyyyyy
pingedyyyyy
post_modifiedyyyyy
post_modified_gmtpost_modifiedy
post_content_filtered[empty][empty][empty][empty][empty]
post_parentparent_idy [0]y [0]y [0]y [0]
guidyyyyy
menu_ordermenu_order
post_type✅ [product]✅ [product]✅ [product_
variation]
✅ [product]✅ [product]
post_mime_type[empty][empty][empty][empty][empty]
comment_count 3yyyy
1 Shows Variation details but not used in frontend
2 See WC_Product_Data_Store_CPT class
3 Duplicated as meta_key “_wc_review_count”
4 Post_status for Variations: “inherit” = enabled / “private” = disabled

Post Meta Fields

Post Meta fields are created by WooCommerce and stored in the POSTMETA table.

✅ = in use
❌ = not in use by this product type

Woo Getter / Setter Keymeta_keySimpleVariableVariationGroupedExternal
variation_description_variation_description4
sku_sku
regular_price_regular_price
sale_price_sale_price
price_price
date_on_sale_from_sale_price_dates_from
date_on_sale_to_sale_price_dates_to
total_salestotal_sales
tax_status_tax_status
tax_class_tax_class
manage_stock 2 _manage_stock
stock_status_stock_status
stock_quantity_stock
backorders_backorders
low_stock_amount_low_stock_amount
sold_individually_sold_individually
weight_weight
length_length
width_width
height_height
Woo Getter / Setter Keymeta_keySimpleVariableVariationGroupedExternal
upsell_ids_upsell_ids
cross_sell_ids_crosssell_ids
children_children
purchase_note_purchase_note
attributes 1_product_attributes
default_attributes_default_attributes
virtual_virtual
downloadable_downloadable
downloads_downloadable_files
download_limit_download_limit
download_expiry_download_expiry
image_id_thumbnail_id
gallery_image_ids_product_image_gallery
rating_count_wc_rating_count
average_rating_wc_average_rating
review_count_wc_review_count
product_url_product_url
button_text_button_text
_file_paths 3
_product_version 3
_wp_old_slug 3
_edit_last 3
_edit_lock 3
1 Attributes are a taxonomy but are stored as post meta field
2 “Manage Stock” for variable products can be done at product and / or variation level
3 In use by WC_Product_Data_Store_CPT class but not in Product Class
4 For Getter / Setter use “get_description”. Method “get_variation_description” is deprecated since Woo 3.0

Taxonomies

WooCommerce uses taxonomies for categories and tags as well as visibility and shipping class. Attributes are also taxonomies, but the assignment of attributes to products is done as postmeta field in array format.

Woo Getter / Setter KeyTermSimpleVariableVariationGroupedExternal
typeproduct_typesimplevariablegroupedexternal
category_idsproduct_cat
tag_idsproduct_tag
shipping_class_idproduct_shipping_class
product_visibility 1
catatalog_visibility [hidden,
catalog, search, visible] 2
[included above]
featured[included above]
average_rating[included above]
stock_status[included above]
1 product_visibility = outofstock, featured, exclude-from-search, exclude-from-catalog, rated-1, rated-2, rated-3, rated-4, rated-5
2 Catalog visibility is saved as product_visbility with terms exclude-from-search, exclude-from-catalog

Here is how the product_visibility is set in WC_Product_Data_Store_CPT:

Leave a Reply

Your email address will not be published.