Mechanic is a development and ecommerce automation platform for Shopify. :)
Useful for stores that are subjected to bot abuse, this task watches for newly-created customers, and deletes any that don't come with an associated order. Optionally, choose to ignore any customers that are created with a certain tag – helpful if you create customers yourself, via the Shopify admin.
Runs Occurs whenever a customer is created. Configuration includes ignore customers having this tag.
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?)
shopify/customers/create
{% assign delete_customer = false %} {% if customer.orders.first == nil %} {% log "Customer has no orders" %} {% assign delete_customer = true %} {% endif %} {% if options.ignore_customers_having_this_tag != blank %} {% assign customer_tags = customer.tags | split: ", " %} {% if customer_tags contains options.ignore_customers_having_this_tag %} {% log "Customer had a whitelisted tag; ignoring" %} {% assign delete_customer = false %} {% endif %} {% endif %} {% if event.preview or delete_customer %} {% action "shopify" %} [ "delete", ["customer", {{ customer.id | json }}] ] {% endaction %} {% endif %}