In the Bricks Facebook group, a user asks:
Is it possible to perform calculations for a meta value in the META QUERY section of Bricks Query loops? I want a similar product query loop to display products with prices close to the current product. So my reasoning is to add to meta queries, one that takes the current price and adds 25% and another where I remove 25%. That way, I limit the suggestions to that range.
Otherwise, can anyone explain the Compare field and how it works? I'm interested in the "Between" option.
This Pro tutorial provides the steps to show products priced within 25% (or any other percentage of your choice) of the current single product.
Let's take a product whose price is $20 for example.
25% of $20 is $5.
After implementing the tutorial, the "Similarly Priced Products" section on this single product page will show the products priced between $20-$5 and $20+$5 i.e., between $15 and $25.
We shall restrict this to simple products.
Step 1
Add the following in child theme's functions.php
(w/o the opening PHP tag) or a code snippets plugin:
This is a BricksLabs Pro tutorial.
For full access login below or create your BricksLabs Pro account