Skip to content

Commit

Permalink
Fix cart submission on Quick Order List (Shopify#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
sofiamatulis authored and KaichenWang committed Jul 26, 2023
1 parent 64e6757 commit 0d97fb8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/quick-order-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class QuickOrderList extends HTMLElement {
}
this.quickOrderListId = 'quick-order-list'
this.variantItemStatusElement = document.getElementById('shopping-cart-variant-item-status');
const form = this.querySelector('form');

form.addEventListener('submit', this.onSubmit.bind(this));

const debouncedOnChange = debounce((event) => {
this.onChange(event);
}, ON_CHANGE_DEBOUNCE_TIMER);
Expand All @@ -76,6 +80,10 @@ class QuickOrderList extends HTMLElement {

cartUpdateUnsubscriber = undefined;

onSubmit(event) {
event.preventDefault();
}

connectedCallback() {
this.cartUpdateUnsubscriber = subscribe(PUB_SUB_EVENTS.cartUpdate, (event) => {
if (event.source === this.quickOrderListId) {
Expand Down

0 comments on commit 0d97fb8

Please sign in to comment.