# Shopify Flow triggers

> Start a Shopify Flow workflow when an order holds an item from an AndOr offer, or when a buyer gets the next-order code.

Source: https://backtrackhq.com/docs/offers/shopify-flow-triggers/

AndOr adds two triggers to Shopify Flow. Use them to tag a customer,
send an email with the next-order code, or let your team know when an
offer sells.

## The two triggers

| Trigger | When it starts |
| --- | --- |
| **AndOr checkout offer accepted** | A new order holds an item the buyer added from an AndOr offer: on the product page, the cart or checkout. |
| **AndOr next-order code issued** | An order was placed while the AndOr Thank you offer was on, so the buyer got the next-order code. |

## AndOr checkout offer accepted

It starts once for each AndOr offer on a new order. It passes:

- **Order:** the order, so every order field is there in Flow,
  including the customer.
- **Offer name:** the offer's message. Where the message has
  placeholders, it shows sample numbers.
- **Offer type:** for example `product_upsell`, `bought_together` or
  `gift`.
- **Place:** where the buyer added it: `product_page`, `cart_page`,
  `cart_drawer`, `checkout`, or `unknown`.
- **Added revenue:** what the offer's items sold for on this order, in
  your store's currency.

## AndOr next-order code issued

It starts when an order is placed while the
[Thank you page offer](https://backtrackhq.com/docs/offers/after-purchase-offers/) is on. It
passes:

- **Order:** the order and its customer.
- **Discount code:** the next-order code the Thank you page shows.
- **Offer type:** `nextOrderCode`, `buyAgain`, `exclusiveProduct`,
  `freeGift` or `orderGoal`.
- **Code terms:** what the code gives, for example "15% off". It's
  empty for a code you typed yourself.

"Issued" means the order qualified for the code. AndOr can't tell if
the buyer looked at the Thank you page.

## Set up a workflow

1. **In Shopify admin, open Apps, then Flow.**
2. **Click Create workflow, then Select a trigger.**
3. **Search for AndOr and pick a trigger.**
4. **Add your conditions and actions, then turn the workflow on.**

Some ideas:

- Add a customer tag when a buyer takes an upsell.
- Send the next-order code to your email app as a customer property,
  then send a reminder.
- Post a message to your team when an offer sells.

## Good to know

- AndOr only sends events for triggers your workflows use.
- Events start after AndOr records the new order, not at checkout.
  Allow a short delay.
- AndOr never sends the same event twice.
- When a lot of orders come in at once, AndOr sends up to 20 events per
  batch for your store. Events over that are skipped, not sent late.
