Hi,
We have a Frequently Bought Together on the product page, and I want to add a quantity dropdown for each product so that customers can select how much they want. I added a select and try to get value in JS, but it doesn’t work. Could someone please give me some suggestions? Really appreciate!!
Hi @Anna_Wang1
Can you kindly share your store link (with the password, if any) with us? We will help you check it and suggest a solution.
Hi, thank you for your reply. My store URL is: https://ctomsinc.com/
I used the backup file to test it so I’m not sure if you could see my code.
Please let me know if you have any questions. Thanks.
Hi @Anna_Wang1
We checked your issue and saw that there are 3 ways that you can try to solve the problem:
-
Method 1: Catch the “onChange” event of the quantity input: When the quantity changes, it will push the selected variant and quantity value into the items array (in case the items array already has this variant, delete that item and then re-push).
-
Method 2: Each variant option will display a quantity input (put the quantity class inside the variant’s for loop), then catch the “add to cart button click” event to cycle through the items and put them in the items array.
-
Method 3: Try to use the variants order module of the B2B Customer Portal app
I hope that this is useful for you.