Flow to Update Customer Metafields to Date + 1

Shopify Partner
3 0 1

Hi everyone, 


We offer an annual membership product. After 1 year, we send an automatic reminder for customers to renew their membership. However I would like customers to be able to view their membership lapse date in their profile. 


I created a customer metafield with namespace a key "custom.membership_lapse_date," and the validation is that it must be a date. 

I have a Flow where if a customer purchases a membership they get tagged with "member," and I would like the next step be to to update the "membership lapse date" metafield to the order date + 1 year. In the flow action for "update customer metafield" I'm stumped on what to put in the "value" section. Can anyone help? Thanks!

Replies 2 (2)

1245 113 148
  1. In the Flow action for "update customer metafield," set the "Namespace" to the appropriate namespace for your custom metafield (e.g., "custom").
  2. Set the "Key" to "membership_lapse_date" to target the specific metafield you created for storing the lapse date.

Now, for the "Value" section, you'll need to use Liquid templating to calculate the date value based on the order date and add one year to it. Here's an example Liquid code snippet you can use:

{{ order.created_at | date: "%Y-%m-%d" | plus: 1 | date: "%Y-%m-%d" }}
Shopify Partner
3 0 1

Thank you for your response. I found the property for "order created" and used this snippet,  but it set the date to January 1, 1970 when I tested it. 



{{ order.createdAt | date: "%Y-%m-%d" | plus: 1 | date: "%Y-%m-%d" }}



No errors in the run log. Any idea why this happened?