VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: EvanGR on November 17, 2022, 12:21:16 PM

Title: Exclude cart field from reaching checkout? "disabled" doesn't work.
Post by: EvanGR on November 17, 2022, 12:21:16 PM
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



Title: Re: Exclude cart field from reaching checkout? "disabled" doesn't work.
Post by: Milbo on December 06, 2022, 15:01:58 PM
You need customfield plugin, instead of this hidden thing. Then you can filter it out with a trigger
Title: Re: Exclude cart field from reaching checkout? "disabled" doesn't work.
Post by: EvanGR on December 07, 2022, 10:32:06 AM
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!