Skip to content

Commit a8a42d0

Browse files
Fix Quick Add when cart type is set to Page (remove data-cart-type) (#1817)
1 parent 6942f02 commit a8a42d0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

assets/product-form.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (!customElements.get('product-form')) {
2626
delete config.headers['Content-Type'];
2727

2828
const formData = new FormData(this.form);
29-
if (this.dataset.cartType != 'page') {
29+
if (this.cart) {
3030
formData.append('sections', this.cart.getSectionsToRender().map((section) => section.id));
3131
formData.append('sections_url', window.location.pathname);
3232
this.cart.setActiveElement(document.activeElement);
@@ -46,7 +46,7 @@ if (!customElements.get('product-form')) {
4646
soldOutMessage.classList.remove('hidden');
4747
this.error = true;
4848
return;
49-
} else if (this.dataset.cartType == 'page') {
49+
} else if (!this.cart) {
5050
window.location = window.routes.cart_url;
5151
return;
5252
}

sections/featured-product.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@
257257
{%- when 'buy_buttons' -%}
258258
<div {{ block.shopify_attributes }}>
259259
{%- if product != blank -%}
260-
<product-form class="product-form" data-cart-type="{{ settings.cart_type }}">
260+
<product-form class="product-form">
261261
<div class="product-form__error-message-wrapper" role="alert" hidden>
262262
<svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-error" viewBox="0 0 13 13">
263263
<circle cx="6.5" cy="6.50049" r="5.5" stroke="white" stroke-width="2"/>

sections/main-product.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@
411411
</noscript>
412412
{%- when 'buy_buttons' -%}
413413
<div {{ block.shopify_attributes }}>
414-
<product-form class="product-form" data-cart-type="{{ settings.cart_type }}">
414+
<product-form class="product-form">
415415
<div class="product-form__error-message-wrapper" role="alert" hidden>
416416
<svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-error" viewBox="0 0 13 13">
417417
<circle cx="6.5" cy="6.50049" r="5.5" stroke="white" stroke-width="2"/>

0 commit comments

Comments
 (0)