Solved

Why is the cart-attribute__field code not working for delivery date?

tahwar
Shopify Partner
2 0 2

Code in cart-template: 
{% for item in cart.items %}
{% if item.product.metafields.my_fields.delivery_selector %}
{% render 'delivery-date' %}
{% break %}
{% endif %}
{% endfor %}
Code in delivery-date.liquid:


<div style="width:300px; clear:both;">
<p class="cart-attribute__field">
<label for="date">Pick a delivery date:</label>
<!--input id="date" required class="required" type="text" !-->
<input name="attributes[Delivery Date]" id="date" placeholder="DEIN LIEFERDATUM" value="{{ cart.attributes.date }}">
</p>
</div>
<script>

$("#date").datepicker({

minDate: "+2d",

beforeShowDay: function(date) {
var day = date.getDay();
return [(day != 6 && day != 0 && day != 1)];
}
})

</script>
For some reason the code is not working. I am not recieving delivery date in the orders additional info

Accepted Solution (1)

Zworthkey
Shopify Partner
5581 642 1572

This is an accepted solution.

@tahwar 
i think code is almost perfect,

But what's the major issues?

View solution in original post

Replies 2 (2)

Zworthkey
Shopify Partner
5581 642 1572

This is an accepted solution.

@tahwar 
i think code is almost perfect,

But what's the major issues?

tahwar
Shopify Partner
2 0 2

idk what happend but it's working now lol.