Auto-delete customers that are created without orders, with Mechanic.

Mechanic is a development platform for Shopify. :)

Auto-delete customers that are created without orders

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 when a customer is created. Configuration includes ignore customers having this tag.

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.

Open source
View on GitHub to contribute to this task
when a customer is created (shopify/customers/create)
ignore customers having this tag
{% 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" %}
      ["customer", {{ | json }}]
  {% endaction %}
{% endif %}
Mechanic tasks are written in Liquid, which makes them easy to write and easy to modify. Learn more about our platform.