src/scripts/sections/product.js
/**
   * Updates the DOM state of the add to cart button
   *
   * @param {boolean} enabled - Decides whether cart is enabled or disabled
   * @param {string} text - Updates the text notification content of the cart
   */
Updates the DOM state of the add to cart button
@param {boolean} enabled - Decides whether cart is enabled or disabled
@param {string} text - Updates the text notification content of the cart
Updates the DOM state of the add to cart button @param { boolean } enabled - Decides whether cart is enabled or disabled @param { string } text - Updates the text notification content of the cart
updateAddToCartState(evt) {
    const variant = evt.variant;
    if (variant) {
      $(selectors.priceWrapper, this.$container)
        .removeClass(cssClasses.hide);
    } else {
      $(selectors.addToCart, this.$container)
        .prop('disabled', true);
      $(selectors.addToCartText, this.$container)
        .html(
          theme.strings.unavailable,
        );
      $(selectors.priceWrapper, this.$container)
        .addClass(cssClasses.hide);
      return;
    }
    if (variant.available) {
      $(selectors.addToCart, this.$container)
        .prop('disabled', false);
      $(selectors.addToCartText, this.$container)
        .html(theme.strings.addToCart);
    } else {
      $(selectors.addToCart, this.$container)
        .prop('disabled', true);
      $(selectors.addToCartText, this.$container)
        .html(theme.strings.soldOut);
    }
  }
updateAddToCartState ( evt ) { const variant = evt . variant ; if ( variant ) { $ ( selectors . priceWrapper , this . $container ) . removeClass ( cssClasses . hide ) ; } else { $ ( selectors . addToCart , this . $container ) . prop ( 'disabled' , true ) ; $ ( selectors . addToCartText , this . $container ) . html ( theme . strings . unavailable , ) ; $ ( selectors . priceWrapper , this . $container ) . addClass ( cssClasses . hide ) ; return ; } if ( variant . available ) { $ ( selectors . addToCart , this . $container ) . prop ( 'disabled' , false ) ; $ ( selectors . addToCartText , this . $container ) . html ( theme . strings . addToCart ) ; } else { $ ( selectors . addToCart , this . $container ) . prop ( 'disabled' , true ) ; $ ( selectors . addToCartText , this . $container ) . html ( theme . strings . soldOut ) ; } }
Updates the DOM state of the add to cart button
 @param {boolean} enabled - Decides whether cart is enabled or disabled
 @param {string} text - Updates the text notification content of the cart
Updates the DOM state of the add to cart button @param { boolean } enabled - Decides whether cart is enabled or disabled @param { string } text - Updates the text notification content of the cart