1

Working with the example Commerce templates. In the cart template there is an example for adding a note. https://craftcommerce.com/docs/line-item-model#note

The code for this form:

<form class="shopForm" method="POST">
<input type="hidden" name="action" value="commerce/cart/updateLineItem">
<input type="hidden" name="redirect" value="shop/cart">
<input type="hidden" name="lineItemId" value="{{ item.id }}">
{{ getCsrfInput() }}

<div class="field">
    <label for="note">Note</label>
    <input type="text" size="20" name="note" value="{{ item.note }}">
</div>

<div class="field">
    <label for="qty">Quantity</label>
    <input type="number" name="qty" min="1" value="{{ item.qty }}">
</div>

<input type="submit" class="btn btn-outline" value="Update">

Very useful but after submitting the form, how can we display this later on in the ordering process? For example on a receipt or the order overview. Also can we view this in the Commerce back end? I was not able to find …

Can anybody shed some light? Thanks!

1

The example template show how to display the note, but here is the jist of it:

{% for item in cart.lineItems %}
 {{item.qty }} x {{ item.description }} - {{ item.note }}
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.