Create your own ecommerce website and start selling successfully with ShopWired today

Create your ecommerce website on ShopWired today.
Start today with 14 days free

Create your own ecommerce website and start selling successfully with ShopWired today

Create your ecommerce website on ShopWired today.
Start today with 14 days free

Including a delivery date field at checkout

Theme Customisations - Coding
25th January 2021

Before you proceed:
The following article contains information that requires you to have some prior knowledge about coding in order to correctly implement the proposed change to your theme. If done incorrectly alterations made to your theme’s code can negatively impact your website causing visual and performance issues. Therefore, we strongly recommend that you only undertake this effort if you are completely confident that you know what you’re doing. If you have no coding experience at all, aren’t entirely comfortable following the instructions in this article or if you simply don’t understand the instructions then we recommend you instead contact our partners, Coding Masters, who will complete the work for you for a set fee.


Pro tip!

If you are using a version 3 or version 4 theme you won't need to add this code to your theme's files to include this field. Instead, you just need to activate a setting in your theme's settings.


If you want to allow your customers to tell you their preferred delivery date at checkout (as shown in the example below) then you can include a 'delivery date' field on the shopping basket page of your website's checkout.

The name of the field is delivery_date, e.g.

<input type="text" name="delivery_date">

To make this field display only when certain delivery rates are selected, you will need to code the Javascript on your theme accordingly.

To display a popup calendar date-picker you'll need to integrate a third party tool into your theme's files.

The form field must be present within the <form> tag on the checkout_basket.twig page that submits the checkout form to the next step.


Once an order is received

A customer's selected delivery date can be viewed on the management system when viewing an order, as shown in the example below.

On the order PDF and order confirmation email, the chosen date can be outputted using the variable {{ order.delivery_date }}.


Other applications

Even though the field name is delivery date, the field does not have to be used for this purpose. It can be used for any purpose where you need to request information from the user on the shopping basket page (as opposed to the checkout page which has a different field, already available, for order comments).