Introduction to Auto Tagging

With Giftship, you can automatically tag Shopify orders based on conditions you set, like the date a customer picked in a datepicker block, or whether they checked “Is this a gift?” in the gift message block. A tag is a label on the order that you can search and filter by in Shopify.

Every rule follows the same pattern. When something happens, and the conditions you set are met, Giftship adds your tag. And it’s not just orders. Rules can also tag draft orders, products, and customers.

This article covers how a rule is built, the most common rules for gifts and delivery dates, and how to test a rule before you rely on it.

Where Your Information Lives

Before you build a tagging rule, you need to consider where the information is collected. That decides where it shows up on the order, and which condition your rule needs.

  • Product Options — information collected on the product page shows up in the line item properties, right below the product title on the order. A line item property is a detail saved against one product.
  • Cart Options — information collected at the cart level shows up in the order’s additional details, also known as note attributes. These are saved against the whole order, not one product.

Each piece of information has a name and a value. On a gift order, giftis the name and yes is the value. For a delivery date, the name is whatever you called your datepicker block, and the value is the date.

A tagging rule depends on where the information lands on the order, and on its exact name. We always recommend keeping two tabs open while you build a rule, the order in one and the rule in the other.

Before You Start

  • Make sure your option sets and blocks are set up in Product Options or Cart Options.
  • Have an order that already contains the information you want to tag. You’ll use it to check the exact names and values, and to test your rule.

The Parts of a Rule

  • Title — a name that keeps your rules organized. It’s only for you, and customers never see it.
  • Auto tag event — what gets tagged, and when. For example, run the rule when an Order is Created, or when it’s Updated.
  • Conditions — what the rule looks for, like whether a line item property or a note attribute exists, or contains a particular word. Conditions can also use other parts of the order, such as the order total or the shipping country. Add as many as you need, then choose All conditions are met or Any condition is met.
  • Tag — the tag itself. It can be plain text, like the word gift, or it can use Liquid, Shopify’s templating language, to pull in information from the order, like a date. You can also mix the two. A tag can be no longer than 40 characters once the dynamic content is filled in, and anything longer gets cut off.
  • Tag behavior — what happens to the tags already on the order. Your tag can be added alongside them, it can replace an existing tag, or the rule can remove an existing tag without adding a new one.

Creating a Rule

  1. Head to the Giftship dashboard and click Auto tagging in the sidebar menu.
  2. Click New rule.
  3. Enter a Title.
  4. Under Auto tag event, choose when the rule runs. To tag new orders, select Order is Created.
  5. Under Conditions, choose All conditions are met or Any condition is met, then set your conditions. Click Add another condition for each extra one.
  6. Under Tag, enter your tag in Tag the order with.
  7. Under Tag behavior, choose Kept as they are, with new tag appended to keep the order’s existing tags and add yours.
  8. Save the rule, then switch it on with the toggle at the top. A new rule stays Disabled until you do.

Remember, the inputs are case sensitive, so type names and values exactly as they appear on the order.

Tag Gift Orders from Product Options

When a customer checks “Is this a gift?” on the product page, Giftship adds a line item property named gift, with a value of yes.

  • Select All conditions are met, since both have to be true.
  • Set the first condition to Line items properties name, Is equal to, gift.
  • Set the second condition to Line items properties value, Is equal to, yes.
  • Enter the tag you want on the order. We go with gift.

The gift message block also adds To, From, and Message properties, so you can build a rule around any of those instead.

Tag the Delivery Date from Product Options

This one’s a little more involved, because the tag is the actual date. When a customer picks a date, Giftship saves it as a line item property, with the date as its value. You choose the property’s name when you create the datepicker block. Ours is called datepicker, so wherever you see datepicker below, use your own name.

  • Select All conditions are met.
  • Set the first condition to Line items properties name, Is equal to, datepicker.
  • Set the second condition to Line items properties value, Contains, and enter a dash. Our datepicker block uses the year, month, day format, with dashes in between, so every date has a dash in it. That confirms a date was actually picked.
  • For the tag, you could keep it simple with plain text, like future date. To tag the order with the actual date the customer picked, paste the Liquid below into Tag the order with.
{% for line_item in order.line_items %}
{% for property in line_item.properties %}
{% if property.first != "datepicker" %}
{% continue %}
{% endif %}
{{ property.last }}
{% endfor %}
{% endfor %}

The Liquid loops through each line item’s properties, skips everything that isn’t the datepicker, and tags the order with that property’s value.

Tag Gift Orders from Cart Options

This works the same way, with one difference. When a customer checks “Is this a gift?” in the cart, Giftship saves it as a note attribute instead of a line item property.

  • Select All conditions are met.
  • Set the first condition to Note attributes name (Additional Details), Is equal to, gift.
  • Set the second condition to Note attributes value (Additional Details), Contains, yes.
  • Enter your tag. We go with gift again.

Tag the Delivery Date from Cart Options

The conditions follow the same pattern as the product page rule, using note attributes.

  • Select All conditions are met.
  • Set the first condition to Note attributes name (Additional Details), Is equal to, datepicker.
  • Set the second condition to Note attributes value (Additional Details), Contains, and enter a dash.
  • For the tag, paste the Liquid below into Tag the order with.
{% for attribute in order.note_attributes %}{% if attribute.name == "datepicker" %}{{ attribute.value }}{% endif %}{% endfor %}

This time, the Liquid loops through the order’s note attributes, finds the one named datepicker, and tags the order with its value.

Tag an Image Swatch File Name

Giftship’s image swatch block, in Product Options, lets customers choose an image when they add a product to their cart. You can tag the order with the file name of the image they picked.

  • Set the condition to Line items properties name, Is equal to, gallery, or whatever you named your image swatch block.
  • For the tag, paste the Liquid below into Tag the order with.
{% for line_item in order.line_items %}
    {% for property in line_item.properties %}
        {% if property.first == "gallery" %}
            {% assign url = property.last %}
            {% assign parts = url | split: "/" %}
            {% assign filename_with_query = parts | last | split: "?" | first %}
            {% assign filename_parts = filename_with_query | split: "." %}
            {% assign filename_without_extension = filename_parts[0] %}
            {{ filename_without_extension }}
        {% endif %}
    {% endfor %}
{% endfor %}

The Liquid finds the image the customer selected, then removes the folder path and the file extension, leaving just the file name.

Testing a Rule

Rules normally run when a new order comes in. To test your rule on an order you already have:

  1. Make sure the rule is saved and switched on.
  2. Under Auto tag event, temporarily change Created to Updated, and save.
  3. Open the order in Shopify, add a throwaway tag, like meow, and remove it. That counts as an update, so Shopify notifies Giftship, and your tagging rule runs.
  4. Refresh the order, and you should see your new tag.
  5. Switch the event back to Created once you’re done testing.

Test every rule thoroughly before you rely on it for live orders.

FAQ

Why didn’t my rule tag the order? Check four things. The rule is saved and switched on. The names and values are typed exactly as they appear on the order, including capital letters. The conditions point to the right place, which is line item properties for Product Options and note attributes for Cart Options. And the event matches what you’re testing, because a rule set to Created only runs on new orders.

My datepicker isn’t called datepicker. What do I change? Use your own name in two places: the condition, and inside the quotation marks in the Liquid.

How long can a tag be? 40 characters, counted after the dynamic content is filled in. Anything longer gets cut off.

Can I tag more than orders? Yes. Rules can also tag draft orders, products, and customers.

Can I add my own text to a date tag? Yes. Type it in the tag field right before the Liquid. For example, adding delivery-date- gives you a tag like delivery-date-2027-05-19.

Can't find the answer in our documentation?
Contact Support