Risk

Advanced return abuse detection

Tracks processed returns in a rolling window and tags customers who cross configurable abuse thresholds.

When to use this template

This template is built for Shopify stores using the JsWorkflows app.

Use this template when you want a ready-made workflow for this use case: Tracks processed returns in a rolling window and tags customers who cross configurable abuse thresholds.

It is designed for Shopify risk review workflows and gives you a production-ready starting point instead of building the automation from scratch.

This workflow uses the Shopify webhook trigger model and starts from the "Returns approve" trigger. It includes setup fields for merchant-facing values, so you can configure the workflow before installing it.

Setup guide

Before you start

This template watches approved returns and keeps a rolling abuse history on each customer.

How it works

  • Trigger: returns/approve
  • Each approved return is added to a rolling history stored in a customer metafield
  • The workflow totals return count and returned value over the configured window
  • If both thresholds are crossed, it tags the customer and can optionally tag the triggering order
  • Compare-digest metafield writes are used so concurrent return approvals do not overwrite each other

Configure in setup

  • Return count threshold: number of approved returns required inside the rolling window
  • Return value threshold: total approved returned value required inside the rolling window
  • Rolling window days: how many days of return history to keep
  • Customer risk tag: customer tag applied when thresholds are crossed
  • Order risk tag: optional order tag applied to the triggering order; leave blank to disable
  • Metafield namespace and Metafield key: where the compact JSON history is stored on the customer

Notes

  • This template is intended for operational review and risk flagging, not automatic enforcement
  • The stored state lives on the customer, so the history moves with the customer record inside Shopify

Setup fields

Return count threshold
numberRequiredconfig

Number of approved returns inside the rolling window required before the customer is flagged.

Return value threshold
numberRequiredconfig

Total approved returned value in shop currency required before the customer is flagged.

Rolling window days
numberRequiredconfig

How many days of approved return history are kept for threshold evaluation.

Customer risk tag
textRequiredconfig

Customer tag applied when the configured thresholds are crossed.

Order risk tag
textOptionalconfig

Optional order tag applied to the triggering order when thresholds are crossed. Leave blank to disable order tagging.

Metafield namespace
textRequiredconfig

Namespace used for the customer metafield that stores the rolling return history JSON.

Metafield key
textRequiredconfig

Metafield key used for the customer state JSON.