Licence
MIT
Version
0.11.0
Deps
1
Size
24 kB
Vulns
0
Weekly
1.3K
@openshop/svelte
Svelte stores for OpenShop's framework-agnostic commerce core.
Derives idiomatic Svelte Readable stores (plus bound actions) from
@openshop/core. Each store
updates only when its slice changes.
Install
npm install @openshop/svelte @openshop/core svelteCart
<script>
import { createCartStores } from "@openshop/svelte";
const { count, actions } = createCartStores(cartStore);
</script>
<button on:click={() => actions.addLine({ merchandiseId: "gid://shopify/ProductVariant/123" })}>
Cart {$count}
</button>actions exposes addLine, addLines, updateLine, removeLine,
setDiscountCodes, setGiftCardCodes, setBuyerIdentity, setAttributes,
setNote and refresh. createCartStores also returns cart, count,
status, isUpdating and error stores.
Also includes selectStore, createVariantSelection and
createPredictiveSearch.
Full documentation: monorepo README.