Exclude cart field from reaching checkout? "disabled" doesn't work.

Started by EvanGR, November 17, 2022, 12:21:16 PM

Previous topic - Next topic

EvanGR

Hello,

I have a hidden (display: none) select box in the addtocart section, which I enable ondemand via JS, when another field is set to a specific option.
The hidden select box is set to "disabled", like so:

<select name="customProductData[234432][432]" class="vm-chzn-select" disabled>
<option value="19794484">Hidden option 1</option>
<option value="19794485">Hidden option 2</option>
</select>

However, when Ι add the product to cart, the disabled select field, along with all its options, are added to the product info in the checkout!

Any idea how to avoid that?

EDIT: The select box is initially set to disabled by JS




Milbo

You need customfield plugin, instead of this hidden thing. Then you can filter it out with a trigger
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

EvanGR

Thank you Milbo.

I am not sure I understand.

I need a 3rd party plugin? Or make a plugin myself?

I use native VM custom fields for this case. Can you point me to an example/source on how to "filter it out with a trigger"?
e.g. A VM code file I can study would be great!

Thank you!