I’m adding a gift boxing section to my cart page, where I want to collect information about what the gift box name is, what products from the cart are included and if they want a gift note. I have built the form which collects the cart attribute information, but I need it to add value to cart as we charge £4 for gift boxing, currently, it just collects the information. I need the form to have a submit button which when clicked adds value to the total cart value, either adding the value directly or adding a product to cart on submit. I also allow multiple boxes to be added so each time a section is added and the submit is clicked it adds 4 pounds.
{% for item in cart.items limit:1%}
{% if item.product.tags contains ‘Can Be_Gift Boxed’ %}
<button type=“button” id=“myCheck” onclick=“myFunction()” name=“attributes[Gift Box My Items]” value=“Gift Box My Items”{% if cart.attributes[“Gift Box My Items”] == “Gift Box My Items” %} checked{% endif %} class=“Button Button–primary Button–full” data-text-swap=“Cancel Gift boxing”>
Gift Box My Items
Gift Boxing
Name:
Which items would you like inside? ( Max 3 items )
{%- for line_item in cart.items -%}
{% if item.product.tags contains 'Can Be_Gift Boxed' %}
{{ line_item.product.title }}
{% endif %}
{%- endfor -%}
Would you like to add a free gift note?
Yes please
No thank you
Type of note
To:
From:
Message: {{ cart.attributes["Message"] }}