Agent skill
woo-catalog
Work with WooCommerce catalog — product types, categories, tags, attributes, product queries, search, related products, and product visibility. Use when managing products programmatically or customizing the catalog display.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/woo-catalog
SKILL.md
WooCommerce Catalog & Products
Before writing code
Fetch live docs:
- Web-search
site:developer.woocommerce.com productsfor product documentation - Fetch
https://woocommerce.github.io/code-reference/for class reference - Web-search
woocommerce custom product type implementationfor custom product types
Product Types
Built-In Types
| Type | Class | Description |
|---|---|---|
| Simple | WC_Product_Simple |
Single product, no options |
| Variable | WC_Product_Variable |
Product with variations (size, color) |
| Variation | WC_Product_Variation |
Individual variation of a variable product |
| Grouped | WC_Product_Grouped |
Collection of related simple products |
| External/Affiliate | WC_Product_External |
Linked to external URL |
Virtual & Downloadable Flags
Any product can be marked:
- Virtual — no shipping (services, memberships)
- Downloadable — digital delivery (files, licenses)
Custom Product Types
- Extend
WC_Product(orWC_Product_Simple) - Register the type via
woocommerce_product_type_selectorfilter - Register the class via
woocommerce_product_classfilter orwoocommerce_product_type_{type}class name filter
Product Factory
WC_Product_Factory resolves a product ID to the correct class:
wc_get_product( $id )— returns the correctWC_Product_*subclass- Uses
woocommerce_product_classfilter to allow custom type resolution
Product CRUD
Creating Products
$product = new WC_Product_Simple();
$product->set_name( 'My Product' );
$product->set_regular_price( '29.99' );
$product->set_status( 'publish' );
$product->save();
Querying Products
wc_get_products( $args ) — primary query method:
type— product type(s)status— post statussku— SKU lookupcategory— category slug(s)tag— tag slug(s)limit,page,offset— paginationorderby,order— sortingmeta_key,meta_value— meta queriesreturn—'objects'(default) or'ids'
WC_Product_Query
Object-oriented query builder — same as wc_get_products() but chainable.
Categories & Taxonomies
Product Categories
Taxonomy: product_cat (hierarchical)
wp_set_object_terms( $product_id, $term_ids, 'product_cat' )get_the_terms( $product_id, 'product_cat' )- Or CRUD:
$product->set_category_ids( [ 12, 15 ] )
Product Tags
Taxonomy: product_tag (non-hierarchical)
$product->set_tag_ids( [ 5, 8 ] )
Product Type
Taxonomy: product_type — internal, determines the product class.
Custom Taxonomies
Register with register_taxonomy() associated with product post type. Set show_in_rest => true for block editor and API support.
Product Visibility
Catalog Visibility
$product->set_catalog_visibility( $visibility ):
visible— shop and searchcatalog— shop onlysearch— search onlyhidden— not visible (accessible via direct URL)
Stock Status
$product->set_stock_status( $status ):
instock,outofstock,onbackorder- Controls visibility when "Hide out of stock" setting is enabled
Product Images
$product->set_image_id( $attachment_id )— featured image$product->set_gallery_image_ids( [ $id1, $id2 ] )— gallery
Variable Products & Variations
Variable Product Setup
- Create
WC_Product_Variable - Define attributes with
set_attributes()(mark asvariation = true) - Create
WC_Product_Variationfor each combination - Each variation has its own price, SKU, stock, image
Variation Attributes
Each variation specifies attribute values:
$variation->set_attributes( [ 'pa_color' => 'red', 'pa_size' => 'large' ] )- Empty value = "Any" (matches all)
Related Products & Upsells
$product->set_upsell_ids( $ids )— upsell products$product->set_cross_sell_ids( $ids )— cross-sells (shown in cart)- Related products auto-calculated from shared categories/tags (filterable via
woocommerce_related_productsfilter)
Best Practices
- Use
wc_get_product()to load products — nevernew WC_Product( $id )directly - Use
wc_get_products()for queries — notWP_Querywithpost_type => 'product' - Use CRUD methods for all property access
- Declare product type support:
show_if_simple,show_if_variableclasses on admin tabs - Cache product data when iterating over large collections
- Use
wc_clean()to sanitize product input data
Fetch the WooCommerce product documentation and code reference for exact method signatures, query parameters, and product type registration patterns before implementing.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?