Page 1 of 1

Storing metadata in each order.

PostPosted: Mon Jul 05, 2021 8:38 am
by konstantinos
Hello,

I want to include some extra metadata with each order (such as the user's referral link).
Is this possible?

Thanks

Re: Storing metadata in each order.

PostPosted: Mon Aug 02, 2021 4:55 pm
by admin
hello, you might want to create the field (cart field only) in virtuemart and mark it as "custom rendered" within opc shopper field configuration (and order field)

then you need to render it inside main opc form in onepage.unlogged(+logged+registration).tpl.php file as

<input type="hidden" name="{your vm field as you created it}" value="<?php htmlentities(json_encode($any_data_you_can_get_with_php)); ?>" id="my_custom_input" />

and/or you might want to inject the data with javascript per the ID of the hidden input.

there are other ways in OPC on how to handle this depending on security and source of the datas.

best regards, stan