I'm trying to work on a Woocommerce ticket plugin. By default, the plugin shows a table including multiple ticket variants as products with a textfield for it`s quantity and a submit button below to add the product(s) to the cart.
I want to replace this textfields with either a radio button or a checkbox so users can select a type of ticket and then hit the submit button to add one piece of it to cart.
My idea is to make either a checkbox or a radio button in the foreach loop that has a value of quantity_ (like the textfield does now) and a value of 1, so that the script adds one ticket to the cart on submitting.
The problem is, that I want to allow users to add only one ticket variant. Radio buttons would suit this, but I would need a different input name for each individual ticket variant. This makes the default behaviour of radio buttons unsuitable, because other radio buttons are not unselected when selecting a radio button with a different name.
I`m looking for some workaround. Either by grouping radio buttons with different names together, or using checkboxes that unselect other checkboxes on the page when clicking them.
Anyone knows a creative solution to this ? I know it might be better to change the script's behaviour to interpret the radio buttons the right way, but I`m not experienced enough nor do I have the time to dig in to the behaviour of woocommerce and/or this script to alter this.
Thanks!