Change the word 'default' in the variables?

Shopify Expert
129 0 11
When there is only one choice for adding items to the cart, the default word inserted in the form is 'default' and I can only change it if I set an additional variable. Is there anyway to change it site-wide so that it says "item" instead? thanks!
Stacelynn
0 Likes
Shopify Partner
484 0 2

You can change the title of the variant, even if there’s only one. After you create a new product, place your cursor over the variant title, “Default”, and an edit button will appear to the left. Click it and change the title to your choosing.

Jared Burns, CEO at Getsy (http://get.sy)
0 Likes
Shopify Expert
129 0 11

ah ha -yes, I see that now, thank you.

I guess I was wondering if there was a way to skip this step and just have the new word populate the field automatically across the site.

But at least it can be changed by hand now

Stacelynn
0 Likes
Shopify Partner
484 0 2

Well, you could add something like this to product.liquid in your variant loop.

{% if variant.title == "Default" %}
    Item
{% else %}
    {{ variant.title }}
{% endif %}
Jared Burns, CEO at Getsy (http://get.sy)
0 Likes
Tourist
327 0 2

Or perhaps only show the variant radio if there are any variants with this:


<div id="variants">
  <!-- check for variants -->
  {% if product.variants.size < 2 %}
  <p>{% if product.available == true %}
  <input type="hidden" name="id" value="{{ product.variants.first.id }}" />
  Buy now for <span class="price">{{ product.variants.first.price | money_with_currency }}</span>

  <!-- one variant and unavailable -->
  {% else %}
  <del><span class="price">Sorry, out of stock</span></del>
  {% endif %}</p>

<!-- variants -->
  {% else %}
  {% for variant in product.variants %}
  <p>{% if variant.available == true %}
  <label for="radio_{{variant.id}}">
  <input class="radio" type="radio" name="id" value="{{variant.id}}" id="radio_{{variant.id}}" {%if forloop.first%} checked="checked" {%endif%} />
  {{ variant.title }} for <span class="price">{{ variant.price | money_with_currency }}</span>
  </label>
<!-- unavailable variants -->
  {% else %}
  <del>{{ variant.title }}&nbsp;<span class="price">Sorry, out of stock</span></del>
  {% endif %}
  </p>
  {% endfor %}
  {% endif %}
<!-- close variants -->
</div>

<!-- show add to cart if available -->
{% if product.available == true %}
<input class="add-cart" type="image"  src="{{ 'btn_add_to_cart.gif' | asset_url }}" alt="Add to Cart" value="Add to Cart" />
{% endif %}
Mike www.anothervision.co.uk
0 Likes
Shopify Expert
129 0 11

I’ll give those a try – thanks!

Stacelynn
0 Likes
Excursionist
1027 0 8

While were on keeping the load of the servers mentioned in another post, I would go with Jared’s first option. Its lighter on the servers, and its easier to maintain on the backend than in the liquid code.

Dan - http://www.xtremechargers.com
0 Likes
Shopify Staff
Shopify Staff
2002 0 41

Oh hah, don’t worry about our servers ;)

Tobias Lütke - Shopify CEO // http://twitter.com/tobi
0 Likes
Tourist
327 0 2

Phew! I was sweating there… thought you might chuck me out for wasting resources : )

Mike www.anothervision.co.uk
0 Likes