Allowing customers to enter order notes
LemonStand allows customer order notes to be specified on any step of the checkout process. Use the following code snippet to create a text field for entering order notes on any checkout partial:
<textarea name="customer_notes"><?= h(Shop_CheckoutData::get_customer_notes()) ?></textarea>
Please note the field name: customer_notes. The customer notes field is not required. If you need to force customers to always enter order notes, you can check whether the field is not empty in the page Pre Action PHP code:
if (array_key_exists('customer_notes', $_POST) && !strlen(trim(post('customer_notes')))) throw new Exception('Please provide order notes');
The code checks whether the customer_notes field is presented in the POST data and if it is presented but empty, throws the exception.
Next: Implementing the Step-By-Step Checkout
Previous: AJAX-driven single-page checkout
Return to Checkout Pages
Comments
No comments posted so far.
Add your comment
Loading form...