{"product_id":"2026-08-22","title":"Show the last order date on a Shopify product page automatically","description":"\u003cp\u003e\u003cspan\u003eAn example setup for showing when a product was last ordered, right on the product page. Shopify doesn't have a built-in field for this, so a Shopify Flow writes the date to a product metafield every time an order is created, and the product page displays it.\u003c\/span\u003e\u003c\/p\u003e\n\u003cp\u003eBecause it's based on orders rather than inventory changes, manual stock adjustments and location-to-location transfers don't trigger it. The value only updates when a real purchase happens.\u003c\/p\u003e\n\u003cp\u003e\u003cimg alt=\"Finished result: last purchase date on the product page\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0733\/0381\/8491\/files\/2026-08-22_1_en.png?v=1787438834\" class=\"zoomable-image\" style=\"max-width:100%;height:auto;\"\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003ch3\u003eWhat this setup does\u003c\/h3\u003e\n\u003cp\u003e\u0026#9670;Create a product metafield to hold the last purchase date\u003cbr\u003e\u0026#9670;Build a Flow that watches for new orders and updates the metafield for every product in the order\u003cbr\u003e\u0026#9670;Add a custom liquid block to the product page to display the value\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003ch3\u003e[Setup step 1] Create a product metafield for the last purchase date\u003c\/h3\u003e\n\u003cp\u003e\u0026#9670;Shopify admin \u0026rarr; Settings \u0026rarr; Custom data \u0026rarr; Products \u0026rarr; \"Add definition\"\u003cbr\u003e\u0026#9670;Name it \"Last purchased at\", type \"Date and time\"\u003cbr\u003e\u0026#9670;Turn on the \"Storefront API access\" option\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003ch3\u003e[Setup step 2] Build a Flow that watches for new orders\u003c\/h3\u003e\n\u003cp\u003e\u0026#9670;Shopify admin \u0026rarr; Apps \u0026rarr; Flow \u0026rarr; \"Create workflow\"\u003cbr\u003e\u0026#9670;Trigger: \"Order created\"\u003cbr\u003e\u0026#9670;Add a \"For each loop (iterate)\" action targeting \u003ccode\u003eorder.lineItems\u003c\/code\u003e\u003cbr\u003e\u0026#9670;Inside the loop, add \"Update product metafield\", targeting the product tied to that line item, with the order's creation time as the value\u003c\/p\u003e\n\u003cp\u003e\u003cimg alt=\"Setup step 1: the Flow\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0733\/0381\/8491\/files\/2026-08-22_2_en.png?v=1787438834\" class=\"zoomable-image\" style=\"max-width:100%;height:auto;\"\u003e\u003c\/p\u003e\n\u003cp\u003eAn order can contain more than one product, so the \"For each loop\" is what lets you process every line item individually. Without it, you can't handle orders with multiple products.\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003ch3\u003e[Setup step 3] Add a custom liquid block to the product page\u003c\/h3\u003e\n\u003cp\u003e\u0026#9670;Open the product page template and add a \"Custom Liquid\" block inside the \"Details\" block\u003cbr\u003e\u0026#9670;Paste the code that displays the metafield value into the Liquid code field (the code is included after purchase)\u003c\/p\u003e\n\u003cp\u003e\u003cimg alt=\"Setup step 2: adding the custom liquid block\" src=\"https:\/\/cdn.shopify.com\/s\/files\/1\/0733\/0381\/8491\/files\/2026-08-22_3_en.png?v=1787438834\" class=\"zoomable-image\" style=\"max-width:100%;height:auto;\"\u003e\u003c\/p\u003e\n\u003cp\u003eFor products that have never been ordered, the metafield is blank and nothing is shown. Simply leaving the text empty can still leave behind the block's own spacing, so this code also hides the block's spacing entirely when there's no value.\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003ch3\u003eOperational notes\u003c\/h3\u003e\n\u003cp\u003e\u0026#9670;The Flow only runs when a new order is created. It doesn't retroactively apply to past orders\u003cbr\u003e\u0026#9670;Because it's based on orders rather than inventory changes, manual stock adjustments and location transfers don't trigger it\u003cbr\u003e\u0026#9670;If the same product appears more than once in an order, each line item is still processed correctly\u003c\/p\u003e","brand":"STORE DOJO","offers":[{"title":"Default Title","offer_id":49213220028667,"sku":null,"price":0.0,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0733\/0381\/8491\/files\/2026-08-22.png?v=1787438987","url":"https:\/\/store-dojo.com\/en-us\/products\/2026-08-22","provider":"STORE DOJO","version":"1.0","type":"link"}