Skip to main content

Post Types & Taxonomies

StoreEngine keeps a deliberately small set of custom post types. Only content that benefits from the WordPress editing experience — products and coupons — is stored as posts. Orders and subscriptions are table-backed and are not post types (see Database Schema).

Post types and core taxonomies are registered in includes/database.php. Their identifiers are exposed as constants on StoreEngine\Utils\Helper (includes/utils/helper.php) — always reference the constant rather than hardcoding the string.

Custom post types

Post typeHelper constantPurposeRegistered by
storeengine_productHelper::PRODUCT_POST_TYPEProducts. Each product owns one or more prices/plans (see Products).includes/database.php
storeengine_couponHelper::COUPON_POST_TYPEDiscount coupons. Wrapped by the Coupon object (see Coupons).includes/database.php
Orders and subscriptions are not post types

Both live in the wp_storeengine_orders table, discriminated by a type column. Load them with the Order and Subscription objects, not get_post().

Product taxonomies

These taxonomies are attached to the storeengine_product post type:

TaxonomyPurpose
storeengine_product_categoryHierarchical product categories.
storeengine_product_tagFlat product tags.
storeengine_product_attributeBase attribute taxonomy for product attributes.

Global (store-wide) attributes

Global attributes are defined in the storeengine_attribute_taxonomies table and registered as taxonomies dynamically at runtime. The taxonomy name for a given attribute is derived through the helper:

use StoreEngine\Utils\Helper;

$taxonomy = Helper::get_attribute_taxonomy_name( 'color' );
$terms = get_terms( [ 'taxonomy' => $taxonomy, 'hide_empty' => false ] );

Because these taxonomies are created from stored definitions, the exact set depends on how the store is configured.

Addon-registered types

Some post types and taxonomies exist only when the relevant addon is active:

TypeKindAddonPurpose
storeengine_membershipPost typeMembershipAccess Groups.
storeengine_webhookPost typeWebhooksOutgoing webhook definitions.
storeengine_in_hookPost typeWebhooksIncoming webhook receivers.
storeengine_product_brandTaxonomyBrandProduct brands.

Querying products

Because products are a CPT, standard WP_Query works:

use StoreEngine\Utils\Helper;

$query = new WP_Query( [
'post_type' => Helper::PRODUCT_POST_TYPE,
'posts_per_page' => 12,
'post_status' => 'publish',
'tax_query' => [
[
'taxonomy' => 'storeengine_product_category',
'field' => 'slug',
'terms' => 'apparel',
],
],
] );

To turn a product post id into a rich product object with prices, stock, and attributes, use the factory rather than working with the raw WP_Post:

$product = Helper::get_product( get_the_ID() ); // AbstractProduct|false
if ( $product ) {
echo esc_html( $product->get_name() );
foreach ( $product->get_prices() as $price ) {
// $price is a Price object; $price->get_id() is the price_id
}
}

See Products for the full object API.

See also