Skip to content

fix(checkout): inherit variant shipping data - #252

Merged
yan-ad merged 1 commit into
mainfrom
fix/shipping-price-variant-parent-volumetric
Jul 16, 2026
Merged

fix(checkout): inherit variant shipping data#252
yan-ad merged 1 commit into
mainfrom
fix/shipping-price-variant-parent-volumetric

Conversation

@yan-ad

@yan-ad yan-ad commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

Variable products can leave weight and dimensions empty on the variation while configuring those values on the parent product. Product readiness already treats this setup as configured, but GetWCCartAttributeService loaded only variation metadata. The resulting /shipping_price payload contained zero weight or dimensions, preventing shipping rates from appearing.

Root cause

The cart attribute resolver selected variation_id as the sole metadata source. Unlike the product readiness checks, it never retained product_id or applied field-level parent fallback. Empty variation dimensions were therefore discarded by volumetric calculation, and empty variation weight remained zero.

Solution

  • retain the parent product ID for variable cart items
  • batch-load weight and dimension metadata for both variation and parent IDs
  • resolve _weight, _length, _width, and _height independently
  • prefer positive variation values and fall back to parent values when missing
  • preserve simple-product handling, quantity aggregation, unit conversion, and volumetric packing
  • cover fully empty variations, partial variation overrides, variation precedence, and simple products

The shared cart attribute service feeds the shipping method, checkout calculation, and ongkir pricing flows, so all storefront shipping_price calls receive the corrected payload.

Verification

  • Focused ParaTest: 2 tests, 15 assertions passed
  • Full make test: 439 tests passed
  • make zip: package/source parity passed
  • git diff --check: passed

@yan-ad
yan-ad merged commit 45ea493 into main Jul 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant