Community Store Saving Order Attribute Issue

Permalink
Hi,
I have a website running Community Store. I have added an order attribute called "receive_marketing" in the dashboard and some code on the checkout page:

<?= $form->text('receive_marketing', $customer->getValue('receive_marketing'), array('required' => 'required')); ?>


I have also added some code to the dashboard order single page:
<?php
                    $receiveMarketing = $order->getAttribute('receive_marketing');
                    if($receiveMarketing == "yes") {
                            echo '<p>Receive Newsletters: Yes</p>';
                    }
                    else {
                            echo '<p>Receive Newsletters: No</p>';
                    }
?>


I don't think this is saving because if I enter "yes" into the field on checkout, it always returns: Receive Newsletters: No

How can I change this to work as an order attribute and save the value entered into the input?

thanks
Dave

madesimplemedia