This custom loop displays products based on a date range, price limit and popularity. THe code includes parameters :
- To order by meta value number (popularity)
- Using total sales as popularity
- For a start and end date
- For products below or equal to a specific price point
The following custom products loop shows products displaying by popularity between a set date range and price limit.
In the above example, we include products under $50 with most sales between and including the 20th December 2023 to 21 May 2024.
Installation
Copy and paste the PHP code to the end of your child themes functions file.
Code Settings
- Set the value for the price limit on line 26.
- Set the start and end dates on line 33 and 34.
Reviews
There are no reviews yet.