Skip to main content
Plugins are for logic around the cart: eligibility gating, analytics, loyalty references, custom line-item properties. They live in a script you load on the storefront — not in the bundle’s JS asset.

Registering

use() returns an unsubscribe function. You can call it before the runtime has installed: a pre-install shim queues plugins and replays them at install time, so script order doesn’t matter. window.nameless.ready resolves once bundle data is loaded, if you need to wait for state rather than just register.

addToCart.before

Runs after selections validate, before the cart request. It can block the add or attach line properties. Return one of:
A block surfaces to the shopper as dispatch code PLUGIN_BLOCKED with "{code}: {message}", and remaining before hooks are skipped. lineProperties are keyed by selector id and land on the matching Shopify cart line as line-item properties. Multiple hooks merge; later hooks win per key.
Do not write the __FB_ATC_UID property. Knit stamps it on every line and the Shopify discount function reads it to group bundle lines and detect stale bundles. Overwriting it silently kills the bundle discount at checkout.

addToCart.after

Fire-and-forget, runs after the cart responds. Same context plus result:
Return nothing, or { warnings: string[] } to surface messages in the host’s warning log. You cannot change the outcome from here.

Execution semantics

Because slow hooks are cut off at 1500ms, keep network calls out of before, or accept that a slow response is treated as “no opinion”.

Worked example

To reshape the theme’s own add-to-cart when ATC override is on, see Resolver stages.