To avoid orders placed without a customization, you can show a warning right on your Cart page when the item added to cart doesn't have a customization. Then your customers can notice and go back to the product to add to cart again.

Please follow the instruction below to add this warning message.

The warning message only shows up for each Line item on Cart which belongs to Teeinblue and has no customization_id.

Go to your Shopify admin -> Themes -> Edit code (of the published theme)



Open a file that build Cart Page contents. It can be in Sections or Snippets folder. Example: cart.liquid, cart-items.liquid, main-cart-items.liquid,...

Find a block code starting like {% for item in cart.items %}



Inside the block code, add the codes below into where you want to show warning message:
{% assign product = item.product %}
{% assign teeProduct = false %}
{% assign hasCustomizationId = false %}
{% assign version = product.metafields.teeinblue.campaign_version %}
{% assign startDate = "2020-03-31 23:59:59" | date: "%s" %}
{% assign endDate = "2020-10-20 00:00:00" | date: "%s" %}
{% assign productCreatedDate = product.created_at | date: "%s" %}
{% assign productVendor = product.vendor | downcase %}

{% if version or productVendor == "teeinblue" and productCreatedDate > startDate and productCreatedDate < endDate %}
  {% assign teeProduct = true %}
{% endif %}

{% if teeProduct == true %}
  {% for property in item.properties %}
    {% if property.first == 'customization_id' %}
      {% assign hasCustomizationId = true %}
      {% break %}
    {% endif %}
  {% endfor %}

  {% if hasCustomizationId != true %}
    <div class="teeinblue-warning-no-customization" style="color: #bf5329;">Error! No customization created. Please add to cart again.</div>
  {% endif %}
{% endif %}


For example, under cart-item__details:



Change the warning message if you want.
The default warning message is "Error! No customization created. Please add to cart again." In the above codes, you can find the line <div class="teeinblue-warning-no-customization">Error! No customization created. Please add to cart again.</div> and change the message.

Save and Done.
Then, when some errors happen and the customization can't be created, a warning message will show up like this:



Contact our support team if you need help.
Was this article helpful?
Cancel
Thank you!