WooCommerce Code Reference

ProductType
in package

Enum class for all the product types.

Table of Contents

EXTERNAL  = 'external'
External/Affiliate product type.
GROUPED  = 'grouped'
Grouped product type.
SIMPLE  = 'simple'
Simple product type.
VARIABLE  = 'variable'
Variable product type.
VARIATION  = 'variation'
Variation product type.
get_all()  : array<string|int, string>
Returns every product type value defined by this enum, as a flat list.

Constants

Methods

get_all()

Returns every product type value defined by this enum, as a flat list.

public static get_all() : array<string|int, string>

It includes self::VARIATION. Variations are real, creatable products, and WC_Product_Variation::get_type() returns this value, but each belongs to a parent rather than standing on its own.

For the top-level types a merchant can pick, use wc_get_product_types(). It returns a value => label map rather than a list, and being filterable it also carries types an extension registered.

Tags
since
10.9.0
Return values
array<string|int, string> —