wc-variations-data
WooCommerce: variations data layer (CRUD + cache)
For plugin code that reads, queries, or programmatically writes product variations. The pricing/display side (filter chain, sale-price overrides, frontend "Variation X is selected" hooks) is sibling skill wc-variations-pricing-filters — this one stops at the data layer.
Misconception this skill corrects
"A variation is just a product. I'll
wp_insert_post( 'product_variation', ... )andupdate_post_metafor price."
Variations work that way at the database level, but the data layer caches aggressively at the parent level. A raw post-insert leaves the parent's stored _price values, lookup table row, child-list transient, and wc_var_prices_<id> transient stale — your variation exists but the catalog shows the OLD price range, "Out of stock" stays on a re-stocked variable product, and frontend variation data may not see the new child until caches are rebuilt.
When to use this skill
Trigger when ANY of the following is true:
- Programmatically creating, updating, or deleting variations (import scripts, sync from external system, CLI tools).
- Reading variation prices for catalog display, custom listings, or reports.
- Debugging "I added a variation programmatically and the parent's price range / stock didn't update".
- Reviewing code where variations are touched via
wp_insert_post,wp_update_post,update_post_meta, or raw$wpdbwrites againstproduct_variationpost type. - The diff or file contains:
WC_Product_Variation,WC_Product_Variable,get_variation_prices,get_available_variations,wc_var_prices_,sync_variation_names, or'product_variation'post type references.