Skip to content

Commit

Permalink
fix(storefront): STRF-12475 Use utils.api.cart.postFormData when upda…
Browse files Browse the repository at this point in the history
…ting variants in cart
  • Loading branch information
jordanarldt committed Dec 17, 2024
1 parent b25b270 commit 14df81a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix GH build action & added package version and short commit hash to artifact names in GitHub Actions workflow for improved traceability and uniqueness. ([#2494](https://github.com/bigcommerce/cornerstone/pull/2494))
- Bump stencil-utils to 6.18.0 ([#2493](https://github.com/bigcommerce/cornerstone/pull/2493))
- Bump other GH actions to fix warnings related to old versions. ([#2495](https://github.com/bigcommerce/cornerstone/pull/2495))
- Use fetch when updating variants in cart ([#2521](https://github.com/bigcommerce/cornerstone/pull/2521))

## 6.15.0 (10-18-2024)
- Cornerstone changes to support inc/ex tax price lists on PDP [#2486](https://github.com/bigcommerce/cornerstone/pull/2486)
Expand Down
12 changes: 12 additions & 0 deletions assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ export default class Cart extends PageManager {
this.$modal.one(ModalEvents.opened, optionChangeHandler);
}

const modalForm = this.$modal.find('form');
const refreshContent = () => this.refreshContent();
async function onSubmit(event) {
event.preventDefault();
utils.api.cart.postFormData(new FormData(this), () => {
modal.close();
refreshContent();
});
}

modalForm.on('submit', onSubmit);

this.productDetails = new CartItemDetails(this.$modal, context);

this.bindGiftWrappingForm();
Expand Down

0 comments on commit 14df81a

Please sign in to comment.