Skip to product information
1 of 1
Published:2024.10.03

Example of setting up Shopify to display "This product has been purchased n times in one week" on the product detail page without using an app

Example of setting up Shopify to display "This product has been purchased n times in one week" on the product detail page without using an app

Applications

  • Product information management and editing

How to implement

  • Shopify Flow
  • LIQUID
  • HTML/CSS
View full details

This is an example of how to display "n units purchased in the past week" on Shopify without using an app. Using Shopify Flow, the purchase history for the past week based on the product purchase date is saved in a variant metafield, and then used to display the total number of purchases for the week on the product page.


Example of setting to display "This product was purchased n times in one week" on the product details page without using the app


[Setup Method 1] Create a variation metafield in JSON format named "custom.recent_7days_sales_count"


[Setup Method 2] Create a Flow that "Save the sales quantity to the variant meta field" triggered by the quantity change "Product variant inventory quantity changed"


[(For Rise/Dawn Themes) Setup Method 3] Add a customized Liquid block to the product information section of the product template and insert the code.


After making a purchase (all items are ¥0), you will be able to view the sample code.

If you have already made a purchase, please login here.

Sample Codes

Test Theme :Dawn/Rise 15.2.0

json schema

Check the metafield value, and if it is the same as the purchase date, update the quantity. If not, add new quantity data for the last 7 days.