Capture Birthday in BirthDate metafield

Hello,

I am trying to capture the birthday of my customer in the standard BirthDate metafield. This is the metafield my third party apps also use.

I made a Shopify form asking for the birthday, but it can only capture the date to a custom metafield. I would need to create a flow to get the date from one field to the other. However, I capture the date in DD/MM/YYYY - the BirthDate metafield doesn’t accept this. It would have to be MM/DD/YYYY.

Has anyone successfully created this flow? I keep fighting with the code :slight_smile:

Thanks!

Hey @Houseofbones,

Can you try the snippet that shared below.

{% assign parts = customer.metafields.custom.your_form_field | split: "/" %}
{{ parts[2] }}-{{ parts[1] }}-{{ parts[0] }}

Why this works: In the above snippet split: “/”: Breaks 25/12/1990 into an array.

Parts[2]: Grabs the Year
Parts[1]: Grabs the month

Parts[0]: Grabs the day

This will bypasses the invalid date errors because you’re handling Shopify a clean ISO-standard string.

Same issue here. I used flow to split the date string (by “/”), then reorder the parts to MM/DD/YYYY before saving to BirthDate. Not ideal but it worked after a few tries.