I am trying to change the date format from YYYY-MM-DD to 'Day of the week, Nth Month Year'

2 0 0

I have assigned a name variable with a delivery date to a product but when it is displayed in the cart notification window and also at checkout, the default date format changes to YYYY-MM-DD. I need to change this to, for example, 'Wednesday, 8th May 2024'.


I can't seem to find any .liquid or .json files in my sections or templates in the code which has the date formatting for these. Is there a way to change the overall default for the whole website or even just for these isolated instances?


I am using Dawn theme.


Please see pictures below.


Thanks in advance!


Screenshot 2024-05-04 at 19.59.34.png

Screenshot 2024-05-04 at 19.59.59.png

Replies 2 (2)

11 1 1

Since the date format is predefined, you won't find code to simply edit - instead you need to overwrite it.


You will need to go to locales/en.json and define a new date format variable that the theme will use to overwrite the way dates are displayed. Once you've done that, you can use the new date format on your product page. I'd suggest googling some articles on "date format" and "shopify", and duplicating your theme before making any edits in case you need to roll-back an error. 


Good luck and let me know if you have questions!

io from Symmetry Commerce
- Was your question answered? Mark it as an Accepted Solution
- Need help with your Shopify store or app? Reach me at: io@symmetrycommerce.com
- https://symmetrycommerce.com
2 0 0

I have added the following into the locales/en.json file:

"date_formats": {
"custom_format": "%A, %e{{ date_variable | date: '_ordinal' }} %B %Y"


However, I am still unable to overwrite the cart notification and checkout date formats with this custom format as they are not hard coded in the liquid files. I think when the cart notification and checkouts are populated by the product, the 'delivery date' name variable that I have assigned to the product is auto populated using a default date format as the variable recognises that it's a date. I can't find this default anywhere in the code editor - really at a loss!


What I've done instead is just changed the date to a string so that Shopify doesn't reformat it but it would be nice to have a proper solution using date formatting.