Shopify Flow payment reminders

Topic summary

Goal: Automate payment reminder emails at multiple intervals and send them to custom B2B recipients stored in Company Location metafields, not just the main contact.

Issue: Using the “Payment schedule is due” trigger led to a failure in “Send order invoice” with error ‘order_id is required but empty.’ Screenshots of the workflow and error were provided.

Root cause: The trigger doesn’t expose an order directly. The action was pulling context from the metafield owner (a location), not an order—possibly a bug.

Fixes/Guidance:

  • Reference the order via paymentSchedule.paymentTerms.order.id (add as a variable).
  • You cannot force “Send order invoice” to use a different ID; it auto-assigns from context. Adjust preceding steps instead.
  • Remove the For Each loop. Fetch each recipient using “metafield (requires arguments)” for specific keys (e.g., email1, email2, email3).
  • Recipient Liquid path shared by OP appears correct (e.g., …purchasingEntity.PurchasingCompany.location.invoiceRecipient1.value).
  • Note: A condition checking if a metafield key exists doesn’t select that value for subsequent actions.

Status: User acknowledged the guidance; approach appears workable. No explicit final confirmation, discussion likely near resolution.

Summarized with AI on December 14. AI used: gpt-5.

Hi all, I am trying to set up Shopfiy Flows to send payment reminders at set intervals (on due date, 3 days past due, 7 days, 14 days, etc.), but I want to send them to custom recipients using the same metafields in this flow https://admin.shopify.com/apps/flow/web/editor/templates/b4dfb34a-33d4-4894-a59b-b571a4af99f2 . The base structure of the payment reminders is here https://admin.shopify.com/apps/flow/web/editor/templates/4d2841f9-1847-499f-8995-f1427f8d4163 .

The problem with the payment reminders standard Flow is that it just sends to the main contact of B2B companies, and although you can customise the invoice Flow to add a custom message, a Flow that starts with the ‘Payment schedule is due’ trigger then fails as it cannot find the correct order (“Ran into exception: Fields: order_id are required but are empty”).

I would appreciate any guidance anyone can offer.

Adam

Can you post a screenshot of that error and your full workflow?

1 Like

Sure, thanks for replying. Here are the screenshots below

You don’t have an “order” available from the trigger. The action is actually using the order attached to the metafield owner, which might be a bug, because I don’t think that owner is actually an order in this case but a location.

Probably the path to the order is payment schedule / paymentTerms / order / id (click “Add a variable” to insert it).

I think your logic has issues as well but hopefully that helps you test a bit.

1 Like

Thanks Paul, do you know how I would force the Send order invoice action to use the order from that path (payment schedule / paymentTerms / order / id)? At the moment it seems to be fixed on the For each loop and takes the information from that, and there’s no way within the Send order invoice action to select the order path

I would remove that For-Each path entirely and instead just get each of the 3 metafield values directly (no looping). Choose “metafield (requires arguments)” instead of metafields.

You cannot currently force an action to use a different ID as it’s auto-assigned. But changing that data is has access to should work

1 Like

So I will remove the For each loop and just change it to Check if metafields key is email1 like this, and now the Send order invoice window looks like this. Do you think that will work now?

I think so, although I can’t tell what’s in that email liquid string

1 Like

As in within the custom message?

no the recipient email address.

1 Like

It’s {{paymentSchedule.paymentTerms.order.purchasingEntity.PurchasingCompany.location.invoiceRecipient1.value}}

I have 3 Company location metafields, which are used to capture additional email addresses to send emails to my customers

Also, I am using the metafields (non-argument) variable as I only need to send to extra_invoice_recipient.email1 which I think the below achieves

That condition just checks if that key exists in the list of metafields. It doesn’t select it for subsequent actions. I’d expect that it’s always true, unless you have locations that do not have an email1. But the liquid you posted previously looks correct.

1 Like

Thank you so much Paul. Really appreciate all your help