<div class="container">
<div class="row justify-content-md-center mt-5">
<div class="col-12">
<div class="card">
<div class="card-body">
<h5 class="card-title">Assigning values for order additional fields</h5>
<p class="card-text">
Click the button bellow to open the Inline Cart using a catalog product and order additional fields with values assigned.
</p>
<a href="#" class="btn btn-success" id="buy-button">Buy now!</a>
</div>
</div>
</div>
</div>
</div>
window.document.getElementById('buy-button').addEventListener('click', function() {
TwoCoInlineCart.cart.setCurrency('USD');
TwoCoInlineCart.cart.setAdditionalFields([
// textbox type example
{
code : 'TextInIPNCustom123',
value : 'Some text value'
},
// listbox type example
{
code : 'SourceOrder',
value : 'The WWW'
},
// hidden type example
{
code : 'cart2cotestorderhidden',
value : 'Some text for the hidden field'
},
// checkbox type example
{
code : 'cart2cotestordercheckbox',
value : true
}
]);
TwoCoInlineCart.products.add({
code: '2CO3MONTHS',
quantity: 1
});
TwoCoInlineCart.cart.checkout();
});