Add last updated inventory level date for products variant

Solved

Add last updated inventory level date for products variant

LADS12
Tourist
3 1 1

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 !

 

Accepted Solution (1)
LADS12
Tourist
3 1 1

This is an accepted solution.

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

View solution in original post

Replies 3 (3)

devcoders
Shopify Partner
1469 173 454

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.)

 

 

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at devcodersp@gmail.com
WhatsApp No: +91 8516919310 If my assistance was helpful, please consider liking and accepting the solution. Thank you!
LADS12
Tourist
3 1 1

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

LADS12
Tourist
3 1 1

This is an accepted solution.

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