top of page
Related Items

Related Items

Recommend products based on price, brand and more.

Intermediate.png

Intermediate

4K

Published:

December 31, 2019

Girl Enjoying her Drink

by

Anchor 1
Hire a Developer

Example Description

In this example, we added a Related Products area to a Wix Stores Product page. This area displays products that relate to the current product based on relationships that we define.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

How We Built It

The Collection We Added: related-products


The related-products collection we added has the following fields:

  • Product A: A reference to a product in the Products collection

  • Product B: A reference to a product in the Products collection

 

This collection is where we manually created a relationship between products. Each item in the collection represents two items in the Products collection that we decided should relate to each other. Note that a product may appear in both the Product A and Product B fields.


Displaying Related Products


On the Product page, we created the Related Products area in a repeater that is inside a strip. The repeater is set to display a maximum of four items, and each repeated item has elements that display the related product’s image, name, and price.

 

When the Product page loads, it tries to find related products in the following ways:

  1. It queries both the Product A and Product B fields in the related-products collection to find any products that are related to the current product.

  2. It queries the Products collection for any products whose price is 20% greater or 20% less than the current product.

 

If either query returns results, it displays those results in the repeater. If no related products are found, the repeater is hidden.


Next Steps


  1. Open this example in the Editor to work with the template.

  2. Publish the site and refresh your browser so the Stores collections appear in the Database.

  3. Learn how to work with examples in Velo.

APIs We Used

Non-code example.

Non-code example.

Related Articles

Article Link

Hire a Developer

Velo solutions are powerful tools, but building them on your own can be challenging. Let an experienced Velo development shop build it for you, so you can keep working on your site or business.

Related Examples

Did this help?

Yes

|

No

Thanks for your feedback!

Product Configurator

Product Configurator

Let customers create one-of-a-kind products.

Intermediate.png

Advanced

Product Reviews

Product Reviews

Build trust with customer ratings and reviews of your products.

Intermediate.png

Advanced

Related Posts

Related Posts

Display related posts in your blog post page

Intermediate.png

Beginner

Anchor 2
bottom of page