New Liquid filter: currency
new
Mechanic now supports a new
currency
filter, used for formatting numbers as currency. This filter defaults to the store's primary currency and default locale, and accepts overrides for both values.
Example usage:
{{ "100000.0" | currency }}
{{ 100000.0 | currency: "EUR" }}
{{ 100000 | currency: "EUR", locale: "fr" }}
{{ 100000 | currency: locale: "fr" }}
Output, for a store based in USD and defaulting to English:
$100,000.00
€100,000.00
€100 000,00
$100 000,00
Read more
New UI settings for ease of use
new
Two new Mechanic settings are now available:
  • Show environment banner
    — This setting is useful for those working across more than one Shopify store.
  • Show advanced task settings by default
    — When enabled, opens the task's advanced settings immediately upon loading the task form. Useful for users who often work on task code.
Both options are available in the Mechanic settings area.
Screen Shot 2021-02-17 at 4
Read more
Echo actions no longer trigger mechanic/actions/perform
new
Mechanic supports responding to action results, via the mechanic/actions/perform event topic. Historically, these events have been generated for
all
action types.
These events are no longer generated for Echo actions, specifically; all other behavior is unchanged.
Read more
The "compact" filter now supports hashes
new
The "compact" filter is a long-standing part of Liquid itself. We've updated our implementation to include explicit support for hashes. The result: Mechanic's implementation removes nil elements from arrays,
and
removes hash keys having nil values.
{% assign foo = hash %}
{% assign foo["bar"] = "baz" %}
{% assign foo["qux"] = nil %}
{{ foo | json }}
{{ foo | compact | json }}
=> {"bar":"baz","qux":null}
=> {"bar":"baz"}
Read more
The "http" action result now includes "body_base64"
new
Alongside the existing
"body"
action result (which is always either UTF8 or the result of parsing response JSON), the "http" action now includes a
"body_base64"
value in its results. This is useful when retrieving binary third-party data (like images) that cannot be represented as a valid UTF8 string.
Read more
New Liquid filters: "keys", "values"
new
Making it easier to work with hashes, Mechanic's Liquid implementation now includes two new filters:
  • "keys" – returns an array of the hash's keys
  • "values" – returns an array of the hash's values
{% assign foo = hash %}
{% assign foo["bar"] = "baz" %}
{% assign foo["qux"] = "quux" %}
{{ foo | keys | join: ", " }}
{{ foo | values | join: ", " }}
=> "bar, qux"
=> "baz, quux"
Read more
The "date" Liquid filter now supports "now" with offsets
improved
Mechanic's "date" filter now supports simple math, resulting in a time offset from "now":
{{ "now + 6 weeks" | date: "%Y-%m-%d %H:%M %z" }}
{{ "now + 3 months" | date: "%Y-%m-%d %H:%M %z" }}
{{ "now - 3 months" | date: "%Y-%m-%d %H:%M %z" }}
=> "2021-02-15 14:06 -0500"
=> "2021-04-04 14:06 -0400"
=> "2020-10-04 14:06 -0400"
Durations may be added or subtracted from "now"; calculations are performed using variable duration lengths, given the naturally varying length of specific days, weeks, months, and years, given DST and other calendar variances, all informed by the store's timezone. This math is backed by ActiveSupport::TimeWithZone#+. An example, quoting from that documentation: "a time + 24.hours will advance exactly 24 hours, while a time + 1.day will advance 23-25 hours, depending on the day".
Read more
New scheduler event topic: mechanic/scheduler/20min
new
Scheduling on twenty-minute intervals is now available, via the new mechanic/scheduler/20min event topic.
Read more
The Mechanic task library is now on GitHub
new
For some time, we've maintained a mirror of all of Mechanic's tasks on GitHub. That mirror has now been promoted to the official source of truth for Mechanic's task library.
Contributions are enthusiastically accepted – if you have changes to existing tasks to propose, or new tasks to add, please file a pull request!
New Liquid filters: gzip, gunzip
new
For scenarios in which tasks must work with gzipped data, we now offer two new Liquid filters: gzip, and gunzip. They work exactly the way they sound. :)
Read more
Load More