Data Context and Dynamic Sources
Woo docs use the same data names that the code uses. This page explains where those names come from and when to use them.
Product Context
ProductDynamicData::extend_post_data() adds an omewoo object to Etch post dynamic data when the current post is a Woo product.
| Expression | Use |
|---|---|
{item.omewoo.*} | Product archive or product loop card. |
{this.omewoo.*} | Single product template. |
{item.id} or {this.id} | Product ID for AddToCartForm.product.product_id. |
{item.omewoo.product.type} or {this.omewoo.product.type} | Product type for AddToCartForm.product.product_type. |
{item.omewoo.attributes} or {this.omewoo.attributes} | Variation attribute loop for AttributeSelector. |
Product dynamic data includes product identity, price text, media, purchase availability, variation payloads, variation attributes, and option availability. See Woo Dynamic Data Tree for the full field-by-field reference for this.omewoo, item.omewoo, cart sources, and selector sources.
Cart Dynamic Sources
CartItemsDynamicSource registers four source keys when the block tree contains cart-aware components or expressions:
| Source | Shape |
|---|---|
cartItems | Cart item rows with key, productId, title fields, attributes, quantity, URL, price text, subtotal text, and image data. |
cartSummary | item_count, line_count, and state where state is has-items or empty. |
cartTotals | Total fields for subtotal/items, discount, shipping, tax, and final price. |
cartCoupons | Applied coupon rows with code. |
The source registration is lazy. A page that does not render cart components does not register cart sources for that request.
Cart Item Hydration
CartItems renders one authored row template. Server render and runtime both hydrate the row's atoms:
| Atom marker | Data field |
|---|---|
data-ome-woo-cart-item-field="image" | Product image URL, srcset, and alt text with authored fallback. |
data-ome-woo-cart-item-field="title" | Product title or composed variant title. |
data-ome-woo-cart-item-field="priceText" | Unit price text. |
data-ome-woo-cart-item-field="subtotalText" | Line subtotal text. |
data-ome-woo-cart-item-quantity | Quantity input value and cart item key. |
data-ome-woo-cart-item-remove | Remove button cart item key. |
data-ome-woo-cart-attribute-list | Selected variation attributes cloned from the attribute template. |
This is why cart item atoms are meaningful only inside a cart item row or an order summary row.
Selector Sources
WooSelectorDynamicSource registers selector rows while blocks render:
| Source | Used by |
|---|---|
shippingRates | ShippingMethodSelector rows. |
paymentMethods | PaymentMethodSelector rows and runtime config. |
Shipping rates use package-aware values. The row value is {package_id}:{rate_id}, while the hidden input keeps the raw Woo rate ID and package-specific input name. This lets Woo distinguish rates across packages.
Payment methods only include enabled simple gateways. Gateways with custom fields are skipped by get_simple_payment_methods(), because this selector renders simple radio/select choices rather than gateway-specific embedded forms.
Checkout Field Schema
CheckoutFieldSchema::build() reads Woo countries, checkout fields, locale overrides, states, and store defaults. The runtime uses that schema to:
- Render country options.
- Switch state between select, text, and hidden modes.
- Apply Woo labels, required flags, hidden flags, field types, autocomplete, and priorities.
- Validate rendered fields before Store API submit.
Address forms still expose copy props, but use_woo_defaults: true keeps Woo's field copy as the default source.
Dynamic Data Examples
Product archive:
{#loop products as item}
<OmeWooAddToCartForm product='{{"product_id":"{item.id}","product_type":"{item.omewoo.product.type}"}}'>
{#slot default}
<OmeWooAddToCartButton behavior='{{"mode":"counter","trigger":"form_submit"}}' />
{/slot}
</OmeWooAddToCartForm>
{/loop}
Single product:
{#loop this.omewoo.attributes as attribute}
<OmeWooAttributeSelector target='{{"attribute":{attribute}}}' />
{/loop}