Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Users can how add multiple "Add to Cart" forms in a single page

NyanKiyoshic2a02414bec2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b75d84df29..71fb8354ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Fix multiple checkbox selected behavior - #4146 by @benekex2
- GraphQL now prints exceptions to stderr as well as returning them or not - #4148 by @NyanKiyoshi
- Refactored API resolvers to staticmethods with root typing - #4155 by @NyanKiyoshi
+- Users can how add multiple "Add to Cart" forms in a single page - #4165 by @NyanKiyoshi
## 2.6.0
diff --git a/saleor/static/js/components/checkout.js b/saleor/static/js/components/checkout.js
index 6b64b1d9e9..3e58ca1ec1 100644
--- a/saleor/static/js/components/checkout.js
+++ b/saleor/static/js/components/checkout.js
@@ -40,10 +40,11 @@ export default $(document).ready((e) => {
});
$('.product-form button').click((e) => {
e.preventDefault();
- let quantity = $('#id_quantity').val();
- let variant = $('#id_variant').val();
+ let $target = $(e.target.form);
+ let quantity = $target.find('input[name="quantity"]').val();
+ let variant = $target.find('input[name="variant"]').val();
$.ajax({
- url: $('.product-form').attr('action'),
+ url: $target.attr('action'),
type: 'POST',
data: {
variant: variant,