Please add end-of-month-based payment terms to Shopify orders and draft orders, with two calculation options:
“X days after end of invoice month”, where the merchant chooses the number of days.
“End of the following month”, which automatically uses the last calendar day of the following month, accounting for different month lengths and leap years.
For example, an invoice issued on any date in November 2026 would be due on 30 December under “30 days after EOM”, or 31 December under “End of the following month”. A January invoice using the latter would be due on the last day of February.
We run a wholesale business with monthly account terms. Currently, we must manually calculate and enter fixed due dates for each order. These options should calculate the actual payment due date, not simply change the wording displayed on the invoice.
I note this has been put on here before and marked as solved by using an app to cover that, however Shopify has the built in option for Companies and B2B price channels, therefore they should have customizable payment terms for x days after EOM, currently I have a work around using a metafield but a paid app (at about $140AUD/m) is a bit expensive for my budget.
Hey @HaldexD2D
Until Shopify adds this, Shopify Flow might replace the paid app, since Flow itself is free. I haven’t seen this exact workflow run, so try it on a test order first.
- Trigger the workflow when an order is created.
- Use a Run code step to work out the due date from the order’s created date. It can handle both of your rules, including month lengths and leap years, because it’s plain JavaScript. Pass the date in as an input, because Run code can’t read the current clock.
- Use a Send Admin API request step with the paymentTermsUpdate mutation to set that date on the order’s payment schedule.
Check first that paymentTermsUpdate shows in that step’s mutation list, because the action supports most Admin API mutations, not all of them. Draft orders would need a separate approach, since paymentTermsUpdate only covers orders.
https://help.shopify.com/en/manual/shopify-flow/reference/actions/send-admin-api-request
using flow to set a metafield with the calculated date works for me tbh just a small script that adds the days to the last day of the month and writes it back I had to add a check for feb leap years but the js Date object handles that ok just remember to run it on order creation so the draft shows the right due date
One detail I’d check before building the Flow above: your rule starts from the invoice month, while the suggested workflow starts from the order date. If an order is placed on 31 October but invoiced on 1 November, those give different due dates.
Does your current metafield workaround store the invoice date, or the final due date? If the invoice date is available, I’d use that as the starting point and check an order invoiced across a month boundary. For a November invoice, your two rules should still give 30 December and 31 December respectively.
@Daniel_Jude’s Flow route works, and the date math is where it usually goes wrong. Build both rules from the invoice month, not the order month, and pass in whichever date you’re treating as the invoice date.
1. Split that date into year and month. JavaScript months are 0-indexed, so November is 10 and January is 0.
2. Last day of the invoice month: new Date(y, m + 1, 0). For “X days after EOM”, add X days to that.
3. Last day of the following month: new Date(y, m + 2, 0). A November invoice gives 31 December, and a January invoice gives the last day of February, with leap years handled.
Return the result as a plain YYYY-MM-DD string and write it to the payment schedule’s due date, not to a metafield that only changes the wording. Format the dates yourself rather than passing a full timestamp, because a timestamp in the wrong time zone can shift the due date back a day.
Test three cases: a November invoice, a January invoice, and an order placed on 31 October but invoiced on 1 November.
If your wholesale buyers check out themselves through company accounts, there’s another route besides Flow: a payment customization Function can set payment terms on B2B checkouts. Double-check the plan and API requirements for that operation in the current docs before building on it. The Function input exposes the shop’s local date. You’d compute the last day of the month plus your X days in the Function, then set a fixed due date, so the order is created with the correct date.
The catch is that it only runs during checkout. Draft orders your team creates in the admin and marks as paid on terms would still need the Flow approach. It also uses the checkout date, which runs into the invoice-date vs order-date point Paul raised.
Roughly what share of your wholesale orders come through B2B checkout versus draft orders your team creates?
One small thing the replies haven’t mentioned: Fixed date exists as a payment term, but only on draft orders. On a draft you can pick the exact due date, so for orders your own team creates you could keep a short list of due dates per invoice month (30 Dec and 31 Dec for November, for example) and skip the manual maths, even before any Flow is in place.
On company locations the options are only Net, Due on fulfillment or none, so a buyer who checks out themselves gets Net terms. Shopify’s doc also says Net terms count from the day the order is placed, not from when you invoice. That is why the Flow or checkout-function routes above end up overwriting the date with a fixed one. I haven’t tested either, so run a test order first.