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 625 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Auto Responsive Grids in Bricks

Auto Responsive Grids in Bricks

This tutorial provides the CSS that can be pasted for automatic responsive grids in Bricks Builder. Posts element Each post will get a right padding…
Pro
Top-Level Product Categories in Bricks

Top-Level Product Categories in Bricks

How to show top-level WooCommerce product categories in Bricks using a query loop.
Categories:
How to List Your Posts Divided by Categories in Bricks

How to List Your Posts Divided by Categories in Bricks

In this tutorial, we'll learn how to display a list of posts divided by each category. The DOM tree Here is how I structured my…
Categories:
Pro
Dynamic Horizontal Posts Accordion in Bricks

Dynamic Horizontal Posts Accordion in Bricks

Creating a horizontal accordion of featured images from posts output by Bricks' query loop.
Categories:
Tags:
Pro
How to Redirect WordPress Search to WooCommerce Shop Filter by Product Title or SKU

How to Redirect WordPress Search to WooCommerce Shop Filter by Product Title or SKU

Learn how to redirect users to the Shop page with filtered results if the searched term matches a WC product title or SKU. And, if…
Categories:
Pro
Posts Grouped by Authors in Bricks

Posts Grouped by Authors in Bricks

This Pro tutorial for Bricks users provides the steps to loop through users and inside that, through posts whilst setting the inner query's author parameter…
Pro
Product Attribute based Related Products Bricks Query Loop

Product Attribute based Related Products Bricks Query Loop

How to output products related by value of attribute(s) for the current product on single WooCommerce product pages.
Categories: