Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Re: How to get multiple select quantity value?

Solved

How to get multiple select quantity value?

Anna_Wang1
Excursionist
72 1 4

 

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!!

 

code1.PNGcode2.PNG

 

Accepted Solution (1)
BSS-Commerce
Shopify Partner
3477 463 547

This is an accepted solution.

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.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency

View solution in original post

Replies 3 (3)

BSS-Commerce
Shopify Partner
3477 463 547

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.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency
Anna_Wang1
Excursionist
72 1 4

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.

BSS-Commerce
Shopify Partner
3477 463 547

This is an accepted solution.

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.

If our suggestions are useful, please let us know by giving it a like, marking it as a solution, or donating here .


B2B Solution & Custom Pricing | Product Labels by BSS


Need help from our expert? Kindly share your request with us via community@bsscommerce.com


BSS Commerce - Full-service eCommerce Agency