Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A 0-dependency cart management library for Shopify Themes ๐Ÿ›’๐Ÿ›โšก

License

Notifications You must be signed in to change notification settings

TinyboxSoftware/Smolcart.js

Repository files navigation

A 3.1kb, 0-dependency cart management library for Shopify Themes.

npm npm bundle size

Features

  1. โšก extremely lightweight (~3.1kb)
  2. ๐Ÿ›’ a simple, promise-based API for interfacing with the cart
  3. ๐Ÿ”ฎ automatic polyfill loading where needed thanks to pollyfill.io

Getting started

smolcart.js can be used with NPM or through a CDN; whichever best fits your workflow.

Install using NPM

  1. open your project and run
npm install --save smolcart.js
  1. in the file where you'd like to use smolcart:
import { init } from 'smolcart.js'
// initialize smolcart.js, this will load polyfills if they're needed.
const cart = init();
// now you can dynamically interact with your cart!
await cart.addItems([{id: '1234', quantity: 1]);
const cartdata = await cart.getCart();
  1. you're good to go! more docs coming soon

Install using a CDN

  1. open the template you'd like to add smolcart.js to
  2. create a script tag that has src attribute pointing to the newest version of smolcart.js on a CDN (we recommend unpkg)
<script
 src="https://unpkg.com/smolcart.js@latest/dist/smolcart.umd.min.js"
 defer
></script>
  1. after the script has loaded, you should be able to initialize smolcart.js:
// initialize smolcart.js, this will load polyfills if they're needed.
const cart = window.smolcart.init();
// now you can dynamically interact with your cart!
await cart.addItems([{id: '1234', quantity: 1]);
const cartdata = await cart.getCart();
  1. you're good to go! more docs coming soon

About

A 0-dependency cart management library for Shopify Themes ๐Ÿ›’๐Ÿ›โšก

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /