Cart - Use cart attributes to collect more information

Hi all,

I am having the same issue described in this thread on “not capturing and displaying cart information in the notification mails and order”. This actually occurs rarely, like once every15-20 orders, but it is still painfully I have automated the capturing of order delivery date into order tag.

I will report here how I have included a datepicker to capture order delivery date. I hope it could be of help and maybe you could give me a hint on why sometimes the date is not captured in the orders.

In the Snippet folder, the delivery-date.liquid file contains:

{{ ‘//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css’ | stylesheet_tag }}> > >

We do not ship on Sundays and holidays.>

So, the delivery date is captured in the variable attributes[date]. The delivery-date.liquid snippet goes into the cart-template.liquid → {% render ‘delivery-date’ %}

The required declaration did not prevent customers from proceeding to checkout without having selected a date. In order to cope with this issue I have added to file theme.js (at the end of the file) the following code:

// This code makes mandatory the choice of delivery date> $(document).ready(function() {> $(‘body’).on(‘click’, ‘[name=“checkout”], [name=“goto_pp”], [name=“goto_gc”]’, function() {> if ($(‘#date’).val() == ‘’ || $(‘#date’).val() === undefined)> {> alert(“You must choose one of the available dates for delivery.”);> return false;> } else {> $(this).submit();> }> });> });

In the Notification section (in Settings), I have added the following to Order Confirmation template:

Fecha de entrega:> {{ attributes.date }}

So given the previous steps, in Order notes an “additional details” section appears where the date (and delivery time even though I have not included it in the code above).

However, as I said before, once every 15-20 orders this information does not appear and I do not have an explanation for this.

Anyone has a clue or could give some help?

Kind regards!