function addVariantToCart(variant, quantity) {
    openCart();

    cart.createLineItemsFromVariants({ variant: variant, quantity: quantity }).then(function() {
      var cartItem = cart.lineItems.filter(function (item) {
        return (item.variant_id === variant.id);
      })[0];
      var $cartItem = renderCartItem(cartItem);
      var $cartItemContainer = $('.cart-item-container');
      $cartItemContainer.append($cartItem);
      setTimeout(function () {
        $cartItemContainer.find('.js-hidden').removeClass('js-hidden');
      }, 0)

    }).catch(function (errors) {
      console.log('Fail');
      console.error(errors);
    });

    updateTotalCartPricing();
    updateCartTabButton();
  }
/* Add 'quantity' amount of product 'variant' to cart
  ============================================================ */
Add 'quantity' amount of product 'variant' to cart
Add ' quantity ' amount of product ' variant ' to cart
function addVariantToCart(variant, quantity) {
    openCart();
    cart.createLineItemsFromVariants({ variant: variant, quantity: quantity }).then(function() {
      var cartItem = cart.lineItems.filter(function (item) {
        return (item.variant_id === variant.id);
      })[0];
      var $cartItem = renderCartItem(cartItem);
      var $cartItemContainer = $('.cart-item-container');
      $cartItemContainer.append($cartItem);
      setTimeout(function () {
        $cartItemContainer.find('.js-hidden').removeClass('js-hidden');
      }, 0)
    }).catch(function (errors) {
      console.log('Fail');
      console.error(errors);
    });
    updateTotalCartPricing();
    updateCartTabButton();
  }
function addVariantToCart ( variant , quantity ) { openCart ( ) ; cart . createLineItemsFromVariants ( { variant : variant , quantity : quantity } ) . then ( function ( ) { var cartItem = cart . lineItems . filter ( function ( item ) { return ( item . variant_id === variant . id ) ; } ) [ 0 ] ; var $cartItem = renderCartItem ( cartItem ) ; var $cartItemContainer = $ ( '.cart-item-container' ) ; $cartItemContainer . append ( $cartItem ) ; setTimeout ( function ( ) { $cartItemContainer . find ( '.js-hidden' ) . removeClass ( 'js-hidden' ) ; } , 0 ) } ) . catch ( function ( errors ) { console . log ( 'Fail' ) ; console . error ( errors ) ; } ) ; updateTotalCartPricing ( ) ; updateCartTabButton ( ) ; }
Add 'quantity' amount of product 'variant' to cart
Add ' quantity ' amount of product ' variant ' to cart