From c0fef7229dd75c8652cc5e151e55310d17af0cc6 Mon Sep 17 00:00:00 2001 From: Lucas Lacerda <37168033+LucasLacerdaUX@users.noreply.github.com> Date: Wed, 22 Jun 2022 10:49:14 -0400 Subject: [PATCH] Fix Quick Add when cart type is set to Page (remove data-cart-type) (#1817) --- assets/product-form.js | 4 ++-- sections/featured-product.liquid | 2 +- sections/main-product.liquid | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/product-form.js b/assets/product-form.js index 974920ad890..6eec3bc2313 100644 --- a/assets/product-form.js +++ b/assets/product-form.js @@ -26,7 +26,7 @@ if (!customElements.get('product-form')) { delete config.headers['Content-Type']; const formData = new FormData(this.form); - if (this.dataset.cartType != 'page') { + if (this.cart) { formData.append('sections', this.cart.getSectionsToRender().map((section) => section.id)); formData.append('sections_url', window.location.pathname); this.cart.setActiveElement(document.activeElement); @@ -46,7 +46,7 @@ if (!customElements.get('product-form')) { soldOutMessage.classList.remove('hidden'); this.error = true; return; - } else if (this.dataset.cartType == 'page') { + } else if (!this.cart) { window.location = window.routes.cart_url; return; } diff --git a/sections/featured-product.liquid b/sections/featured-product.liquid index c5e12f21349..e5aba9c027f 100644 --- a/sections/featured-product.liquid +++ b/sections/featured-product.liquid @@ -257,7 +257,7 @@ {%- when 'buy_buttons' -%}
{%- if product != blank -%} - +