An 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.
Because 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.

What this setup does
◆Create a product metafield to hold the last purchase date
◆Build a Flow that watches for new orders and updates the metafield for every product in the order
◆Add a custom liquid block to the product page to display the value
[Setup step 1] Create a product metafield for the last purchase date
◆Shopify admin → Settings → Custom data → Products → "Add definition"
◆Name it "Last purchased at", type "Date and time"
◆Turn on the "Storefront API access" option
[Setup step 2] Build a Flow that watches for new orders
◆Shopify admin → Apps → Flow → "Create workflow"
◆Trigger: "Order created"
◆Add a "For each loop (iterate)" action targeting order.lineItems
◆Inside the loop, add "Update product metafield", targeting the product tied to that line item, with the order's creation time as the value

An 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.
[Setup step 3] Add a custom liquid block to the product page
◆Open the product page template and add a "Custom Liquid" block inside the "Details" block
◆Paste the code that displays the metafield value into the Liquid code field (the code is included after purchase)

For 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.
Operational notes
◆The Flow only runs when a new order is created. It doesn't retroactively apply to past orders
◆Because it's based on orders rather than inventory changes, manual stock adjustments and location transfers don't trigger it
◆If the same product appears more than once in an order, each line item is still processed correctly
