Add last updated inventory level date for products variant

Hi everyone,

I’m trying to build a Flow that updates a product metafield named last_stock_update (type: date_time) whenever the inventory quantity of one of its variants changes.

i have created a metafield date/time in product section named last_stock_update

i am not able to get it work correctly, did you find a solution ?

Thanks !

1 Like

Hello @LADS12

Step-by-Step Flow Setup

Use the trigger: Inventory quantity changed

Condition (optional but recommended):
If you want to update only when the quantity actually changes (not stays the same), add:

Condition: Inventory Level > Quantity Changed

Value: is not equal to 0

Add action: Update product metafield

Metafield details:

Namespace: (your namespace, e.g. custom)

Key: last_stock_update

Type: date_time

Value: {{ now | date: “%FT%TZ” }}

(This uses the current date-time in the required ISO format.)

thanks for your answer, but this is not working and returning this error : « now » is not a valid link, please replace the variable.

to help people who needs a solution, i found this variable : {{productVariant.updatedAt}}

it takes inventory levels, but also variant modifications

in case you use only inventory movements, it will be fine