But the field isn’t being incremented by 1 for each item as expected. If an order has 3 items in it, it will still just increment the field by 1 for the whole order.
If I make a new order, the field will be incremented by 1 each time, so I can see it’s at least reading the existing value correctly.
Sum is a good lead (I didn’t know it existed, I just started using Flow), but I also need to be able to count only products that are in a certain collection in the order.
In this case I’d rather jump to “update metafield” straight from the trigger and loop over line items and count in the liquid code in metafield value.
If not – adding logging and little sleep (using Wait action) inside your loop may help if the problem is with multiple consecutive metafield updates failing.