Skip to content

Instantly share code, notes, and snippets.

@carolineschnapp
carolineschnapp / hear-about-us.liquid
Last active June 21, 2021 20:44
Asking a customer “how did you hear about us” on the cart page in Shopify
{% assign choices = "Facebook, Twitter, Google, Best Toys Bulletin, John Doe" %}
{% assign required = true %}
<div class="form-vertical">
<p>
<label for="how-did-you-hear-about-us">How did you hear about us?</label>
<select id="how-did-you-hear-about-us" name="attributes[how-did-you-hear-about-us]">
<option value=""{% if cart.attributes.how-did-you-hear-about-us == "" %} selected{% endif %}>Please make a selection</option>
{% assign optionsArray = choices | split: ',' %}
{% for o in optionsArray %}