Skip to content

Commit

Permalink
Fix Quick Add when cart type is set to Page (remove data-cart-type) (S…
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasLacerdaUX authored and Thomas Timmers committed Aug 29, 2022
1 parent 273a109 commit c0fef72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions assets/product-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion sections/featured-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
{%- when 'buy_buttons' -%}
<div {{ block.shopify_attributes }}>
{%- if product != blank -%}
<product-form class="product-form" data-cart-type="{{ settings.cart_type }}">
<product-form class="product-form">
<div class="product-form__error-message-wrapper" role="alert" hidden>
<svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-error" viewBox="0 0 13 13">
<circle cx="6.5" cy="6.50049" r="5.5" stroke="white" stroke-width="2"/>
Expand Down
2 changes: 1 addition & 1 deletion sections/main-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@
</noscript>
{%- when 'buy_buttons' -%}
<div {{ block.shopify_attributes }}>
<product-form class="product-form" data-cart-type="{{ settings.cart_type }}">
<product-form class="product-form">
<div class="product-form__error-message-wrapper" role="alert" hidden>
<svg aria-hidden="true" focusable="false" role="presentation" class="icon icon-error" viewBox="0 0 13 13">
<circle cx="6.5" cy="6.50049" r="5.5" stroke="white" stroke-width="2"/>
Expand Down

0 comments on commit c0fef72

Please sign in to comment.