11th Dec '22
/
11 comments

[WooCommerce] Up-Sells and Cross-Sells Query Loop in Bricks

[WooCommerce] Up-Sells and Cross-Sells Query Loop in Bricks

Updated on 25 Jul 2024

Bricks has a "Product up/cross-sells" element that is built in.

If you want more control to visually build your WooCommerce product upsells and cross-sells, it is possible to use the Query Loop feature.

Upsells and cross-sells for products can be set in the Product data meta box in the Linked Products tab.

This Pro tutorial provides the steps to set up up-sells and cross-sells in the single product template. We are going to ensure that the Section having the heading and the query loop will be output only if there's at least 1 up-sell product (if showing up-sells) or at least 1 cross-sell product (if showing cross-sells).

Edit your single product template with Bricks.

Upsells

Set up a query loop for outputting the products set as upsells for the current product.

Here's a sample JSON of a section you could copy and paste. Delete the Products pagination element after pasting.

This will show the latest 10 products. In the next step, we shall limit these to only up-sells of the current product.

Click on the query icon for your product block and enable PHP query editor.

Paste:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

How to create filters with IsotopeJS in Bricks (Part 3): apply multiple filters

How to create filters with IsotopeJS in Bricks (Part 3): apply multiple filters

This tutorial will review how to apply multiple filters to an isotope container using the IsotopeJS library‘s features in Bricks.
Pro
Post-specific ACF Repeater Galleries as Sliders in Bricks

Post-specific ACF Repeater Galleries as Sliders in Bricks

How to output ACF Repeater field rows with the images of the Gallery-type sub field as a slider.
Querying Posts by Date Field to Exclude Past Events with ACPT Plugin

Querying Posts by Date Field to Exclude Past Events with ACPT Plugin

In the Bricks' Facebook group, a user asked: Meta query? What am I missing?Hi all, really need a little guidance on this one. I have…
Categories:
How to display a Query Loop in 3 columns in Bricks

How to display a Query Loop in 3 columns in Bricks

This tutorial provides the builder settings and CSS codes that can be pasted in order to create a 3-columns query loop container inside Bricks Builder.
Categories:
Pro
Mixed Post Types Grid in Bricks

Mixed Post Types Grid in Bricks

How to set up a mixed post types grid in Bricks, where you can display both standard posts and custom quote cards in alternating positions.
Categories:
Pro
Current Post’s Terms in Bricks

Current Post’s Terms in Bricks

Updated on 15 Jan 2024 This Pro tutorial provides the steps to set up a grid of terms (like categories) that the current post is…
Pro
Nav Menus Custom Query Types in Bricks

Nav Menus Custom Query Types in Bricks

Updated on 21 Aug 2024 This Pro tutorial shows how custom query types for each navigation menu can be generated in Bricks. This enables us…