Skip to content

[Plugin] Storefront checkout never sends shipping method, zone or coupon, so orders get zero shipping and tax #305

Description

@LazyyVenom

Problem

The storefront checkout never sends a shipping method, shipping zone or coupon code, so every order is quoted with zero shipping and zero tax, and there is no way to enter a coupon.

  • The domain already accepts all three: packages/domain/src/orders/create-order-from-cart.ts:60-64 (shippingZoneId, shippingMethodId, couponCode), passed into the quote at :255-257.
  • packages/plugin/src/storefront/checkout-routes.ts never sets any of them, and the summary hard-codes shippingSelected: false (:208).
  • sites/staging/src/pages/checkout/index.astro has only name, email, phone and address fields: no coupon input and no shipping choice. The live page tells the buyer "shipping or tax — this store hasn't set them up yet", even when the merchant has configured zones, methods and rates on the Shipping/Tax admin pages.
  • Separately: tax takes its zone from the request rather than the shipping address (packages/domain/src/pricing/quote.ts:75-84). With no zone sent, tax is 0. An unknown tax class also silently becomes 0 (packages/domain/src/pricing/compute-totals.ts:44).

So the merchant's Shipping, Tax and Coupons configuration has no effect on storefront orders.

Needs a decision

How is a zone chosen: from the shipping address's country/region, or picked by the buyer? Should tax follow the shipping zone automatically?

Proposed scope

  1. The checkout route accepts and passes through shippingMethodId, shippingZoneId and couponCode.
  2. The storefront adds a shipping method picker and a coupon field, and shows validation errors from the quote.
  3. Tax zone derived from the address, per the decision above.

Prerequisite

#286: the in-process checkout contract cases should run first.

Validation

  • Contract tests for a quote with a zone, a shipping method and a valid, invalid or expired coupon.
  • A storefront Playwright test: with a zone, rate and coupon configured, the checkout summary and the created order's totals match.

Found in a read-only audit of main @ 3264354.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions