Mechanic is a development and ecommerce automation platform for Shopify. :)
Using Judge.me for reviews? Use this task to keep a counter for each customer's reviews, stored as a metafield on the customer record. And, auto-tag customers as they reach different levels of review counts - useful for granting discounts or special access to repeat reviewers.
Runs Occurs when a Judge.me review is created. Configuration includes metafield namespace, metafield key, and tags to apply for review counts.
Using Judge.me for reviews? Use this task to keep a counter for each customer's reviews, stored as a metafield on the customer record. And, auto-tag customers as they reach different levels of review counts - useful for granting discounts or special access to repeat reviewers.
After installing this task, activate Judge.me's Mechanic integration: Settings > Integrations > Admin Backend > Mechanic.
Notes:
Mechanic is designed to benefit everybody: merchants, customers, developers, agencies, Shopifolks, 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.
(By the way, have you seen our documentation? Have you joined the Slack community?)
judgeme/review/created
{% assign metafield_namespace = options.metafield_namespace__required %} {% assign metafield_key = options.metafield_key__required %} {% assign customer = shop.customers[review.reviewer.external_id] %} {% if event.preview %} {% capture customer_json %} { "admin_graphql_api_id": "gid://shopify/Customer/1234567890", "metafields": [ { "namespace": {{ metafield_namespace | json }}, "key": {{ metafield_key | json }}, "value": 0 } ] } {% endcapture %} {% assign customer = customer_json | parse_json %} {% endif %} {% if customer %} {% assign current_review_count = customer.metafields[metafield_namespace][metafield_key].value | default: 0 %} {% assign next_review_count = current_review_count | plus: 1 %} {% assign next_review_count_as_string = next_review_count | append: "" %} {% assign tag = options.tags_to_apply_for_review_counts__keyval[next_review_count_as_string] %} {% action "shopify" %} mutation { metafieldsSet( metafields: [ { ownerId: {{ customer.admin_graphql_api_id | json }} namespace: {{ metafield_namespace | json }} key: {{ metafield_key | json }} value: {{ next_review_count_as_string | json }} type: "number_integer" } ] ) { metafields { id namespace key type value owner { ... on Customer { id } } } userErrors { code field message } } {% if tag != blank %} tagsAdd( id: {{ customer.admin_graphql_api_id | json }} tags: {{ tag | json }} ) { node { id } userErrors { field message } } {% endif %} } {% endaction %} {% endif %}