I'm trying to set an Entries field within a Commerce Order once the order completes.
I've tried using the onOrderComplete event like so;
craft()->on('commerce_orders.onOrderComplete',function($event){
$order = $event->params['order'];
$order->setContent(array( 'calculation' => 678 )); // magic number for testing
craft()->commerce_orders->saveOrder($order);
});
and also;
craft()->on('commerce_orders.onOrderComplete',function($event){
$order = $event->params['order'];
$order->calculation = 678; // magic number for testing
craft()->commerce_orders->saveOrder($order);
});
With no luck.
I have also tried setting the field value on the add to cart form with
<input type="hidden" name="fields[calculation][]" value="678">
Again with no luck (I am using MultiAdd so thought it might not be working because of that).
Can anyone point me in the right direction here?