wc-variations-data

Read, query, and write WooCommerce product variations data with WC_Product_Variation.

21|1|Updated Apr 29, 2026
One-click install
npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wc-variations-data
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wc-variations-data
Source: https://github.com/Lonsdale201/wp-agent-skills/tree/main/woocommerce/wc-variations-data
Command: npx skills add https://github.com/Lonsdale201/wp-agent-skills --skill wc-variations-data

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Read, query, and write WooCommerce product variations data across parent/child relationships, ensuring caches and pricing data stay in sync.

Core Features & Use Cases

  • Read/write Variation data with WC_Product_Variable and WC_Product_Variation
  • Invalidate and re-synchronize parent data after changes using wc_delete_product_transients and WC_Product_Variable::sync
  • Debug and validate variation pricing and stock inheritance in the data layer
  • Use cases include programmatic variation creation, bulk updates, and UI-ready variation data retrieval via get_available_variations

Quick Start

Create a variation with WC_Product_Variation, assign parent and attributes, save it, then call wc_delete_product_transients and WC_Product_Variable::sync to refresh the parent.

Frequently Asked Questions about wc-variations-data

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync WooCommerce product variations after programmatic creation?

To sync WooCommerce product variations, create the variation with WC_Product_Variation, save it, then call wc_delete_product_transients and WC_Product_Variable::sync to refresh the parent product and invalidate stale pricing caches.

Why does WooCommerce show stale variation pricing after bulk updates?

Stale variation pricing occurs when transients like wc_var_prices_<parent_id> are not invalidated after mutations. Clearing these transients and running WC_Product_Variable::sync forces the data layer to refresh inherited pricing and stock data.

How do I retrieve UI-ready WooCommerce variation data for the front end?

Retrieve UI-ready WooCommerce variation data by calling get_available_variations on the parent variable product, which prepares formatted and validated variation attributes, pricing, and stock status for front-end display.

What is the correct way to write WooCommerce variation data programmatically?

Writing WooCommerce variation data programmatically requires instantiating WC_Product_Variation, assigning the parent ID and attribute attributes, saving the object, and then executing parent syncing via WC_Product_Variable::sync to maintain data integrity.

Does updating WooCommerce variation stock require parent product syncing?

Yes, updating WooCommerce variation stock requires parent product syncing. Programmatic writes must invalidate pricing transients using wc_delete_product_transients and trigger WC_Product_Variable::sync to ensure accurate stock inheritance across parent-child relationships.