Auto-publish products tagged with the current day with Mechanic.

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

Auto-publish products tagged with the current day

by Isaac Bowen (team@usemechanic.com)

Use this task to automatically roll out your products on specific days of the week. This task runs every midnight, in your shop's local timezone, and it scans your catalog for unpublished products tagged with the current day of the week (e.g. "Monday", "tuesday", etc).

Runs every day at midnight and when a user triggers the task.

15-day free trial – unlimited tasks

Documentation

This task runs every midnight, in your shop's local timezone, and it scans your catalog for unpublished products tagged with the current day of the week (e.g. "Monday", "tuesday", etc).

You can also run this task manually, to publish any unpublished products tagged with the current day of the week.

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
every day at midnight (mechanic/scheduler/daily)
when a user triggers the task (mechanic/user/trigger)
Script
{% if event.preview %}
  {
    "action": {
      "type": "shopify",
      "options": [
        "update",
        [
          "product",
          1234567890
        ],
        {
          "published": true
        }
      ]
    }
  }
{% else %}
  {% assign dow_tag = "now" | date: "%A" | downcase %}
  {"log": {{ "Publishing unpublished products tagged with '" | append: dow_tag | append: "'" | json }}}

  {% for product in shop.products.unpublished %}
    {% assign product_tags = product.tags | downcase | split: ", " %}
    {% if product_tags contains dow_tag %}
      {
        "action": {
          "type": "shopify",
          "options": [
            "update",
            [
              "product",
              {{ product.id | json }}
            ],
            {
              "published": true
            }
          ]
        }
      }
    {% endif %}
  {% endfor %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.