Skip to content
Advertisement

Add a quantity radio selector field to Ajax add to cart button on WooCommerce shop page

My product has a maximum quantity of 10. Customers often choose to buy many types at the same time. Hence I want to have a radio quantity selector (1 – 10) at the shop page.

I already know how to show quantity picker at the shop page and how to use WooCommerce radio form. But I don’t know how to make a quantity radio selector.

Based on Add a quantity field to Ajax add to cart button on WooCommerce shop page answer code, this is my code attempt:

JavaScript

Any suggestion to get the code working?

Advertisement

Answer

It looks like your missing the additional jQuery required to make this work. I know you requested to make this work with a radio select but maybe to save space you want to consider a select?

The following code does just that.

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement