Compare
BricksUltimate Compare lets visitors collect products and compare them side by side. Add a Compare button to product cards or single-product pages, show a running count in the header, and let shoppers review their selections on a dedicated page or in a compact drawer.
Add Compare Controls to the Storefront
(BU)Add To Compare
- Open your single-product template or the repeated product card in a Bricks query loop. Add (BU)Add To Compare inside the product context, but outside any link that already wraps the card.
- Set Post type to Products. Use the same post type in the counter, the comparison table or query loop, and any remove controls.
- Choose a Default icon, an Added icon, and an optional Loading icon. Set the Add to compare and Delete from compare text, and provide a descriptive Aria label for an icon-only control.
- Test on the storefront. The first click adds the current item and updates the matching counter. Another click removes it unless Disable remove action is enabled. If you disable removal here, give shoppers a clear way to remove items on the Compare page or in the drawer.
Use the tooltip controls for different text before and after an item is added. To display an add confirmation with a link to the comparison, create a Section template in Bricks → Templates and select it under Notification template.
If you use the native Bricks WooCommerce Products, Product Upsells, or Product Related element, look for Compare → Enable compare button in its controls. Use the standalone button for custom query-loop cards.
Compare a Specific Variation
- In the single-product template, place the Compare button alongside the variable product's Add to Cart form.
- Give the Add to Cart element or an enclosing wrapper a unique CSS class, such as
compare-atc. The matching element must contain the WooCommerce variation form; do not target the inner submit button. - Enter
.compare-atcin the Compare button's Single Add To Cart button selector. Keep its Post type set to Products. - Select all required attributes, such as size and colour, before clicking Compare. With an identified variation the button can save that variation's ID. Without a complete selection it targets the parent product. Test two variations of one product and verify that removal affects only the entry you chose.
(BU)Compare Counter
Place the counter in a header or toolbar and set Post type to Products. Under Call to action, choose Link to URL and select your Compare page. Choose None for a display-only counter or when another interaction controls what clicking it does.
Choose an icon, text, or both, and display the count inline or in a bubble. Hide it when empty hides only the zero count; Hide button when empty hides the entire control. Keep the button visible if it is the main way shoppers reach the page.
Build a Side-by-Side Compare Page
- Under Pages → Add New, create a page named Compare and edit it with Bricks. This is a regular WordPress page. Add your heading and a link back to the shop.
- Insert (BU)Compare Items once. Under Contents, set Post type to Products. This element reads the visitor's compare list directly and does not need a separate Query Loop.
- Under Add Contents, add a field for each row you want to compare. Label is the text at the left of the row; each saved item gets its own value in a column. Use
as the label when you want the label cell left visually blank. - Publish the page and link to it from your counter, a navigation item, or an add confirmation. Add two products on the storefront before opening it so you can verify the columns and rows.
Set Up the Table Rows
- Dynamic data: Put the tag in Content. For example, use
{featured_image_tag}for the image,{woo_product_price}for price,{woo_product_sku}for SKU,{woo_product_stock_status}for availability, and{woo_product_rating}for ratings. Choose tags from the Bricks Dynamic Data picker to match the data available on your site. - Heading, Basic Text, Text Link, Button, and Icon: Select Type → Element to use a formatted row. For example, use
{post_title}as the title, or add a View product text link and select the current post URL with dynamic data. Use the text word limit for a short summary where appropriate. - Product specifications: Add one row per useful spec, such as capacity, material, or warranty. Use the same WooCommerce attribute or custom field and units across comparable products. For a custom field supplied by ACF or another integration, insert its tag using the Dynamic Data picker. Check products without a value so blank cells are not mistaken for zero.
- Remove Item: Add an Element → Remove Item row, with a text label such as Remove or a clearly labelled icon. It removes the saved item from the comparison, not from the catalogue or cart. You do not need to add a separate interaction to this built-in control.
- Add To Cart, (BU) Add To Cart, and Quantity: When WooCommerce is active, choose the native or BricksUltimate add-to-cart row. To pair a separate Quantity row with the BricksUltimate button in the same product column, use
.bu-atc--{post_id} .brxe-bu-atc ain Add To Cart button selector. Test the chosen quantity in the cart. Keep a product link for parent products that need shoppers to choose options.
Style and Test the Table
- Use Table Cells for column widths, minimum width, padding, and borders. Use Labels to style the row labels separately. Price, rating, quantity, cart, remove, and button controls have their own styling groups.
- The table scrolls horizontally. Under Arrows, choose the left and right icons and set Display after to the number of items that must be exceeded before arrows appear. For example,
3shows arrows from the fourth item. This sets arrow visibility, not a limit on how many items can be compared. - Keep labels short and columns wide enough to read. Start with image, name, price, and the few specs that affect a buying decision. Test horizontal scrolling on a phone with several items, as well as the layout with only one item.
- Enable Refresh content via AJAX if visitors can add items while the table is already on the same page, such as when it shares a page with a product grid. The table listens for adds on the current page; it is not a live sync between browser tabs.
Place an empty-state message outside the table, with a link to browse products. Use the BricksUltimate condition Has compare items? with Products selected. Set it to false for the empty message and true for content intended only for a populated list. If the table needs to refresh via AJAX from an initially empty state, keep the table element rendered so the refresh has a target. Test both adding the first item and removing the last one.
Build a Custom Compare Items Loop
Use a Bricks query loop instead of the built-in table for a card grid, a vertical list, or a drawer with thumbnails. A loop gives you full control over the item layout; use the table when you need each product's specs aligned in shared rows.
- Add a wrapper for the list, then add one Block inside it as the repeated item. Enable Use query loop on that inner Block.
- Choose Ultimate Query Builder as the query type, choose Compare Items under Ultimate query type, and set Post type to Products. Enable Disable query merge if the setting is shown so the surrounding page query does not override the custom query.
- Add dynamic images, titles, fields, and product links inside the repeated Block. Use Posts per page, Order by, and Order to configure the list. Add Bricks Pagination outside the repeated item for longer lists and connect it to the loop. Sorting by published date uses the product's date, not the date it was added to Compare.
- For a custom remove control, add a Bricks Button inside the repeated Block. Under Interactions, choose a Click trigger and Delete Compare Item as the action. Set Post type to Products and Post ID to
{post_id}. That must be the current loop item's ID, especially when comparing variations of the same parent. - If the comparison lives in tabs, set Tab selector to the CSS class or ID of the tab trigger you want restored on reload. Test item removal on a populated list, after pagination, and after removing the last item.
Build an AJAX Mini Compare Drawer
- Add a Bricks Block in an off-canvas panel or an inline section. In the Block's Style → Mini Compare controls, enable Using for Mini Compare Builder?. This lets BricksUltimate refresh the wrapper's contents when the list changes.
- Inside the wrapper, add a child Compare Items query loop as described above. Keep each item compact with an image, title, and a remove action. Add a link to the full Compare page outside the repeated item.
- Enable Hide contents when compare is empty to hide specific controls in an empty drawer. Give those elements a class and enter its selector under Content selectors, for example
.mini-compare-actions. Do not include the empty message or the panel's close control in that selector. - On the BricksUltimate Off Canvas element, use Mini Compare → Reveal to open the panel after a product is added to the compare list. Review the delay, duration, and auto-close options, and keep a manual way to open and close the panel.
For other custom feedback, use the Bricks interaction triggers (BU)Added to compare, (BU)Removed from compare, and (BU)Updated compare. For example, update a nearby status message when the list changes. Check the specific add and removal paths you use; the Updated compare trigger also covers the dedicated remove action.
Guest and Account Lists
Guests keep their compare list in a browser cookie. It does not follow them to another browser, and clearing site data removes it. The Compare cookie life setting in BricksUltimate → Misc offers 1 week, 1 month, 3 months, and 1 year options. Signed-in visitors use an account list, and guest selections from the same browser are merged into that list on login without duplicating item IDs.
To compare WordPress posts or another registered post type, choose that type consistently in every element, condition, query, and interaction. For example, a custom listing site could compare floor area, location, and amenities using dynamic fields and omit all WooCommerce rows.
Troubleshooting
- Compare or its button is missing: Check the feature and license, then confirm the element uses the post type of the current item. For a Bricks template preview, select a representative product under Populate Content.
- The page is empty even though the counter has items: Confirm the table has a post type and at least one row. For a custom layout, check for Wishlist Items selected by mistake, and confirm that the loop uses Compare Items and the same post type as the counter.
- One variation seems to replace another: Select a complete variation before adding it. Check that the selector matches a unique wrapper that contains
.variations_form, then inspect both entries on the Compare page. - A row is the same in every column: Use dynamic data for the current item rather than static content or a selected post. Verify that the field exists on the product or variation being compared.
- The page or drawer shows stale selections: Check that the table or mini wrapper has the appropriate AJAX option. Because comparison is personalised, exclude the Compare page from shared full-page caching or configure the cache to respect compare cookies and logged-in sessions. Test in separate browser sessions.