Skip to content
This repository was archived by the owner on Nov 19, 2025. It is now read-only.

Latest commit

 

History

History
59 lines (45 loc) · 1.33 KB

File metadata and controls

59 lines (45 loc) · 1.33 KB

Shopify MiniCart JS

Features 🚀

  • Slide-out min-cart
  • Total quantity indicator
  • Easy deployment & customizable
  • Custom cart endpoint support
  • Global usage through window.mini_cart

Integration ⚙️

  1. Copy files to corresponding directories into your theme
  2. Modify theme.liquid file (follow the sample in layouts folder)

Usage ✅

  1. Add data-minicart-open data attribute to trigger open mini cart.
  2. Add data-minicart-totalCount to show cart total items quantity.

Sample:

<button data-minicart-open type="button">MINICART - <span data-minicart-totalCount>{{ cart.item_count }}</span></button>

Add window.mini_cart.updateCart() after add to cart script.

Sample:

 _addItemToCart: function(data) {
      var params = {
        url: '/cart/add.js',
        data: $(data).serialize(),
        dataType: 'json'
      };
      $.post(params)
        .done(
          function(item) {
            window.mini_cart.updateCart()
          }.bind(this)
        )
        .fail(
          function(response) {
            console.error(response)
          }.bind(this)
        );
    }

TODO ⏳
  • Support of Compare at price

🌟 Feel free to Star and PR. sanjar.dev