@amboras-dev/meta-shops-checkout
v0.2.0
Published
Meta Shops 'checkout on another website' handoff for Amboras storefronts — builds a fresh cart (line items + discount) from the deep-link URL params and activates it for checkout
Keywords
Readme
@amboras-dev/meta-shops-checkout
Storefront half of the Facebook & Instagram Shop plugin (facebook-instagram-shop).
When a shopper checks out from a Meta Shop configured with "Checkout on another website", Meta sends them to a deep-link on the merchant's storefront:
https://store.example.com/checkout?products=variant_x:4,variant_y:2&coupon=SAVE10&cart_origin=meta_shopsThis package exports a single rootProviders slot component,
MetaShopsCheckoutProvider, that:
- Detects the deep-link (only on the checkout path, only when
cart_origin=meta_shops). - Builds a fresh cart with exactly the items Meta sent (
variantId:qty). The retailer_id Meta returns is the Medusa variant id, so it maps straight tocreateLineItem. - Applies the
couponas a cart promotion (a bad coupon is skipped, not fatal). - Makes it the storefront's active cart (
localStorage.medusa_cart_id+ invalidates the shared['cart']query) and strips the URL params.
It is idempotency-guarded (a refresh won't re-add items) and fully inert on every other page/URL.
What it does NOT do
Payment-session initialization is left to the storefront's useCheckout, which
auto-initializes it once the shopper provides a shipping address + method —
Medusa ties the payment amount to shipping, and Meta does not send an address,
so payment cannot (and should not) be pre-initialized.
Installation
Installed automatically by the Amboras plugin pipeline as part of the
facebook-instagram-shop plugin (it is the manifest's npm_package). It is a
Class A integration — declarative rootProviders binding, no storefront source
edits.
