Tag new products and remove the tag after 21 days with Mechanic.

Mechanic is the one-tool-does-it-all automation app for Shopify. :)

Tag new products and remove the tag after 21 days

by Ken Parelius (team@usemechanic.com)

This task tags your new products when they are created, and removes that tag after 21 days. Edit the subscription field to change how long they remain tagged.

Runs when a product is created and 21 days after a product is created. Configuration includes tag for new products.

15-day free trial – unlimited tasks

Developer details

Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Gurus, everybody.

That’s why we make it easy to configure automation without code, why we make it easy to tweak the underlying code once tasks are installed, and why we publish it all here for everyone to learn from.

Events
when a product is created (shopify/products/create)
21 days after a product is created (shopify/products/create+21.days)
Options
tag for new products (required)
Script
{% if product_tags contains "new" %}
    {% assign product = product.reload %}
    {
      "action": {
        "type": "shopify",
        "options": [
          "update",
          ["product", {{ product.id | json }}],
          {"tags": {{ product.tags | remove_tag: options.tag_for_new_products__required | json}}}
        ]
      }
    }
{% else %}
    {% assign product = product.reload %}
    {
      "action": {
        "type": "shopify",
        "options": [
          "update",
          ["product", {{ product.id | json }}],
          {"tags": {{ product.tags | add_tag: options.tag_for_new_products__required | json }}}
        ]
      }
    }
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.
Defaults
Tag for new products
new