React v2.2.0 updates the Spwig platform’s JavaScript tools with new capabilities for managing regional settings, subscriptions, and cart data. This release aligns with the core Spwig system and SDK updates, offering improved type safety and functionality for developers while maintaining backward compatibility.
What’s new
- Regional management: New
useSetRegion()hook lets merchants update shipping regions, affecting product availability, pricing, and currency dynamically. - Subscription workflows:
useBeginSubscriptionTokenSetup()anduseAttachSubscriptionToken()simplify creating and binding reusable payment methods for recurring orders. - Cart & product details: Updated
CartItemincludes sale and subscription metadata, while product types now reflect stock status and pricing changes.
Why it matters
Merchants gain tools to handle complex regional logistics and subscription setups without code changes. Developers benefit from clearer type definitions and stable hook interfaces, reducing migration risks. These updates ensure cart and product data stays accurate across regional and subscription-based scenarios.
Release notes
2.2.0 (2026-08-06)
Tracks @spwig/sdk 2.2.0 and the Spwig 1.7.1 release. Requires
@spwig/sdk ^2.2.0.
This minor carries breaking changes inherited from @spwig/sdk 2.2.0
(sale-pricing, region availability, subscription tokens). It ships as a minor
deliberately. There are no breaking changes in the React layer itself: every hook re-uses the SDK’s payload types, so the breaks surface as SDK type changes, not renamed or
removed hooks. See the @spwig/sdk 2.2.0 changelog for the field-level detail
and migration steps.
Added
useSetRegion()— mutation wrappingstore.setRegion(country). Sets the
shopper’s ship-to region and invalidates catalog (productships_to_region/
regional stock), cart (regional pricing), and currency.useBeginSubscriptionTokenSetup()— mutation wrapping
subscriptions.beginTokenSetup(). Begins provider-agnostic setup for a
reusable subscription payment method; the returned bundle mints a token you
then bind withuseAttachSubscriptionToken().useAttachSubscriptionToken()— mutation wrapping
cart.attachSubscriptionToken(). Binds a PaymentToken to a subscription cart
line and invalidates the cart. Requires an authenticated shopper.
Changed
- Inherited breaking type changes from
@spwig/sdk2.2.0 (no hook renamed or
removed):Product.compare_at_price_amountis now null-off-sale (use the new
effective_price_amount+is_on_sale);Product.is_in_stockincludes
pre-order/backorder;CreatePaymentIntentInput.checkout_session_idis a
number; theadminattribute-assign payload, branding update, and bulk
price/sale bounds changed. Consumers ofuseCatalog/useProduct,
useCreatePaymentIntent, and the affected admin hooks should re-typecheck and
follow the SDK migration notes. CartItemnow carries sale + subscription fields (is_on_sale,
regular_total,pricing_tier_details,subscription_billing_display,
subscription_unit_price); theuseAddToCartoptimistic placeholder was
updated to populate them.