All Projects β†’ discolabs β†’ Cartjs

discolabs / Cartjs

Licence: mit
A Javascript library to power cart management for Shopify themes.

Programming Languages

coffeescript
4710 projects

Labels

Projects that are alternatives of or similar to Cartjs

gatsby-starter-shopifypwa
πŸ’šπŸ›’πŸ’š Bodega is a Shopify PWA using Gatsby JS + Netlify CMS
Stars: ✭ 100 (-75.85%)
Mutual labels:  shopify
shopify-product-csvs-and-images
Shopify product CSVs and images to seed your store with product data.
Stars: ✭ 76 (-81.64%)
Mutual labels:  shopify
Oauth
πŸ”— OAuth 2.0 implementation for various providers in one place.
Stars: ✭ 336 (-18.84%)
Mutual labels:  shopify
vscode-liquid-snippets
Shopify Liquid Template Snippets
Stars: ✭ 22 (-94.69%)
Mutual labels:  shopify
gatsby-starter-shopify
A Gatsby starter using the latest Shopify plugin showcasing a store with product overview, individual product pages, and a cart
Stars: ✭ 229 (-44.69%)
Mutual labels:  shopify
koa-shopify-starter
A slightly modified version of https://github.com/Shopify/unite-react-node-app-workshop.
Stars: ✭ 14 (-96.62%)
Mutual labels:  shopify
gatsby-plugin-apollo-client
πŸ“‘Inject a Shopify Apollo Client into the browser.
Stars: ✭ 20 (-95.17%)
Mutual labels:  shopify
Gatsby Shopify Starter
πŸ› Simple starter to build a blazing fast Shopify store with Gatsby.
Stars: ✭ 356 (-14.01%)
Mutual labels:  shopify
nextjs-shopify-auth
Authenticate your Next.js app with Shopify.
Stars: ✭ 54 (-86.96%)
Mutual labels:  shopify
Next Shopify Storefront
πŸ› A real-world Shopping Cart built with TypeScript, NextJS, React, Redux, Apollo Client, Shopify Storefront GraphQL API, ... and Material UI.
Stars: ✭ 317 (-23.43%)
Mutual labels:  shopify
contentful-ui-shopify
Integrate Shopify products with Contentful CMS
Stars: ✭ 28 (-93.24%)
Mutual labels:  shopify
shopify-development-resources
A List of resources for Shopify development
Stars: ✭ 56 (-86.47%)
Mutual labels:  shopify
Shopify Theme Lab
Shopify theme development environment using Liquid, Vue and Tailwind CSS πŸ§ͺ
Stars: ✭ 250 (-39.61%)
Mutual labels:  shopify
gridsome-source-shopify
Shopify source plugin for Gridsome
Stars: ✭ 15 (-96.38%)
Mutual labels:  shopify
Theme Scripts
Theme Scripts is a collection of utility libraries which help theme developers with problems unique to Shopify Themes.
Stars: ✭ 337 (-18.6%)
Mutual labels:  shopify
create-shopify-app
Create Shopify App With JWT Authentication using NodeJs, React, Shopify Polaris and MongoDb
Stars: ✭ 58 (-85.99%)
Mutual labels:  shopify
Shopify-Theme-Framework
Shopify Theme Framework
Stars: ✭ 90 (-78.26%)
Mutual labels:  shopify
Shopifysharp
ShopifySharp is a .NET library that helps developers easily authenticate with and manage Shopify stores.
Stars: ✭ 390 (-5.8%)
Mutual labels:  shopify
Php Shopify
PHP SDK for Shopify API
Stars: ✭ 355 (-14.25%)
Mutual labels:  shopify
Web Configs
Common configurations for building web apps at Shopify
Stars: ✭ 302 (-27.05%)
Mutual labels:  shopify

Build Status npm version Bower version

Cart.js

Cart.js is a Javascript library that makes it easy to add dynamic cart features to Shopify themes.

It abstracts away the difficult parts of working with Shopify's AJAX API and provides a simple, consistent interface to manipulating a customer's cart. Without having to worry about the quirks in Shopify's endpoints or about making all of your requests synchronous, you can just write code like this:

function example() {
  // Clear the existing cart.
  CartJS.clear();

  // Add 3x "12345678" items, with a custom "size" property of "XL".
  CartJS.addItem(12345678, 3, {
    "size": "XL"
  });

  // Add multiple items in a single call. 
  CartJS.addItems([
    {
      id: 12345678,
      quantity: 3,
      properties: {
        "size": "XL"
      }
    },
    {
      id: 87654321,
      quantity: 2
    }
  ]);

  // Set a custom cart note.
  CartJS.setNote('This is a custom cart note.');
}

Neat, huh? But that's just the beginning.

Cart.js bundles two powerful optional modules that make it even easier to build dynamic carts into your themes:

Data API Module

Lets you use simple data-* markup attributes to hook in to Cart.js methods, without having to write any Javascript yourself.

For example, to create a button that added a particular product to your cart, all that's required is:

<button data-cart-add="12345678">Add Product</button>

DOM Binding Module

In combination with Rivets.js, the DOM Binding module lets you write HTML templates in your .liquid files that are re-rendered dynamically when the contents of your cart change, like this:

<div data-cart-view>
    You currently have {cart.item_count} item(s) in your cart, for a total of {cart.total_price | money_with_currency}.
</div>

Getting Started and Documentation

Documentation and examples are available on the home page.

You can check out a list of who's using Cart.js in production on the Built with Cart.js page.

Dependencies

Cart.js currently depends on jQuery for its AJAX helpers, custom event bindings and utility methods. This usually isn't a problem as most Shopify themes ship with jQuery.

Rivets.js is required if you want to use the DOM Binding module. The distribution of Cart.js includes a minified asset (rivets-cart.min.js) which contains both the Cart.js library and a bundled version of Rivets.js.

Release History

Refer to the change log for a full list of changes.

Contributions

Contributions are very much welcome! Read our contribution guidelines for details on submitting pull requests that will be accepted.


About the Author

Gavin Ballard is the founder, CEO, and occasional developer at Disco Labs, a Shopify Plus partner agency specialising in solutions for merchants with complex needs.

Thanks

Thanks to the following people who have contributed their time and code to Cart.js!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].