Skip to content

How to Add a WooCommerce Product Compare in WordPress?

Key Takeaways

  • Nexter Blocks Product Compare block adds a floating compare trigger button and a pop-up modal so shoppers queue products, review specs and prices together, and compare WooCommerce products side by side.
  • Product Compare block works in the Gutenberg block editor and can be placed in a header, a sticky bar, or inside product listing templates to show a compare trigger button where the store layout needs it.
  • Count Badge mode renders a compact icon button with a live count of queued products, and clicking it opens the full comparison modal.
  • Post Listing block with Custom style and Product type renders an Action Button on each product card, while the header trigger count badge updates when a visitor clicks it.
Table of Contents

Do you want to let shoppers compare WooCommerce products side by side before they buy? The Product Compare block in Nexter Blocks adds a floating compare trigger button and a pop-up modal to any Gutenberg page, so visitors can queue up products, review specs and prices together, and make a more confident purchase decision.

The Product Compare block is a Gutenberg block in Nexter Blocks for WordPress that works with WooCommerce. Unlike standalone comparison plugins, it integrates directly with the block editor, so you can place it in a header, a sticky bar, or inside product listing templates to show a compare trigger button wherever it makes sense for your store layout. (Pro)

Best Used For:

  • WooCommerce stores selling similar products (electronics, clothing, accessories) where customers need to compare specifications before buying
  • Shop pages using the Post Listing block set to query WooCommerce products, where a per-product "Add to Compare" button is placed inside a custom card template
  • Header navigation bars where a compact count badge should show how many products are currently queued for comparison

Required Setup

  • Make sure the default WordPress block editor is active.
  • You need Nexter Blocks installed and activated.
  • For this block, you need Nexter Blocks (Pro). The Product Compare block is available automatically, so no separate toggle is needed.
  • WooCommerce must be installed and activated. The block will not render on the front end without it.

How to Use the Product Compare Block in WordPress?

The Product Compare block works in two modes selected by the Type setting in the Trigger Button panel. Choose the mode that matches where you are placing the block.

Mode 1: Standalone Trigger (Header or Navigation Bar)

Place the Product Compare block anywhere on a page or in a header template. Leave Type set to Count Badge (the default). The block renders as a compact icon button showing a live count of products the visitor has queued for comparison. When clicked, it opens the full comparison modal. This mode is standalone and does not need to be placed inside any other block.

  1. Open a page, header, or template in the Gutenberg block editor.
  2. Click the + inserter, search for Product Compare, and add it to the canvas.
  3. In the Trigger Button panel, confirm Type is set to Count Badge.

Mode 2: Per-Product Button (Post Listing Block with Custom Style)

To show an "Add to Compare" button on each individual product card, use the Post Listing block configured to query WooCommerce products with a Custom style. The Post Listing block loops through products using a standard WP_Query, and for each iteration the current product context is set so the Product Compare block can detect it and render a per-product button.

  1. Add a Post Listing block to your page or template.
  2. In the Content panel, set Post Type to Product to query WooCommerce products.
  3. Set Style to Custom.
  4. Under Custom Style, choose Reusable Block and select or create a reusable block that contains the Product Compare block with Type set to Action Button. Alternatively, use the Custom Skin option to add the Product Compare block directly as an inner block inside the Post Listing block.

The Post Listing block sets the product context for each loop iteration. The Product Compare block detects that context, renders a unique compare toggle for each product card, and updates the header trigger's count badge when a visitor clicks it.

Note: If you place the Product Compare block outside a product loop with Type set to Action Button, it falls back to the standalone trigger behavior and does not output a per-product button.

Trigger Button

The Trigger Button panel controls how the compare button appears on the page: its type, size, alignment, and spacing.

  • Enable Hover: turns on hover interaction effects for the trigger button.
  • Type: sets the button mode. Count Badge renders a standalone header trigger with a live product count, used outside product loops. Action Button renders a per-product toggle, used inside a Post Listing block configured with Custom style and Product type.
  • Alignment: positions the trigger button left, center, or right within its container. Responsive.
  • Icon Size: sets the width and height of the compare icon inside the button, from 10px to 60px. Responsive.
  • Padding: adds space inside the button between the icon and the button edge. Responsive.
  • Margin: adds space outside the button to push it away from surrounding elements. Responsive.

Modal

The Modal panel controls the size of the compare overlay window that opens when a visitor clicks the trigger button. In the Modal Max Width field, set the maximum width of the comparison modal in pixels, from 400px to 1600px. Use a wider value (1200px or more) when comparing products with many attribute rows so visitors can read each column without horizontal scrolling.

Nexter Blocks WooCommerce Compare block Layout inspector settings

How to Style the Product Compare Block?

To style the Product Compare block, go to the Style tab in the block's Inspector panel. The Style tab has 24 panels covering every element of the trigger button, the comparison modal, and the product picker.

  • Trigger Button: border, border radius, and box shadow of the trigger button. Sub-tabs set separate background and icon color for Normal, Hover, and Active states.
  • Count Badge: typography, border radius, and padding of the count badge. Sub-tabs set background and text colors for Normal and Hover states.
  • Modal: modal background, border, border radius, box shadow, and overlay backdrop color.
  • Modal Header: background, border, title text color, title typography, title icon color, and padding of the header bar.
  • Modal Count Badge: typography, border radius, background color, and text color of the count badge inside the modal header.
  • Close Button: border radius and Normal or Hover background and icon colors for the close button.
  • Clear All Button: typography, border radius, and Normal or Hover background, text color, and border for the "Clear All" button.
  • Table: border color and cell padding for the product comparison table.
  • Label Column: background color, text color, and typography of the first column, which displays attribute labels such as Price, Stock Status, and Review.
  • Delete Button: typography, border radius, and Normal or Hover styling for the button that removes a product from the table.
  • Add Product Button: typography, border radius, and Normal or Hover styling for the button that opens the product picker.
  • Select and Read More Button: typography, border radius, and Normal or Hover styling for the action buttons at the bottom of each product column.
  • Product Image: background, border, border radius, and image size for the product thumbnail in each column.
  • Product Title: typography and Normal or Hover text color for the product name in each column.
  • Price: typography and color of the product price in the comparison table.
  • Stock Status: typography and color of the stock availability label.
  • Quantity Control: appearance of the quantity input in each column, including field background, text color, and border.
  • Add to Cart Button: typography, background, text color, border, border radius, and hover states for the Add to Cart button in each column.
  • Review: color and size of the star rating display in each column.
  • Product Picker: background, border, and padding for the product picker overlay that opens when a visitor clicks "Add Product".
  • Picker Close Button: background color and icon color for the close button inside the product picker.
  • Picker Search: background, text color, border, and padding for the search input inside the picker.
  • Picker Item: background, text color, border, and hover states for each product result row in the picker.
  • Picker Add Button: typography, background, text color, border, border radius, and hover states for the "Add" button on each picker result.

This is how you can add a WooCommerce product compare in WordPress with Nexter Blocks.

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!

Related Frequently Asked Questions

What do I need before adding a WooCommerce product compare in WordPress?

The setup is pretty specific: the default WordPress block editor has to be active, Nexter Blocks must be installed and activated, and WooCommerce must be installed and activated. The Product Compare block is available in Nexter Blocks Pro, so there is no separate toggle for it. If WooCommerce is missing, the block will not render on the front end, which is the main gotcha people hit when the compare button seems to disappear.

Why isn’t the product compare block showing on the front end?

The most common cause is missing WooCommerce, because the block will not render on the front end without it. Another frequent issue is using the wrong context: Action Button mode only works as a per-product toggle inside a Post Listing block set to Product with Custom style. Outside a product loop, it falls back to standalone trigger behavior instead of outputting a per-product button.

Can I use the product compare button in a header or navigation bar?

That is one of the intended uses. In standalone mode, the Product Compare block can sit in a header template or anywhere on a page and show a compact Count Badge trigger with a live queue count. That makes it useful for navigation bars where shoppers need a persistent compare entry point while browsing multiple product pages.

How do I add an Add to Compare button on each WooCommerce product card?

The per-product version depends on the Post Listing block querying WooCommerce products with Custom style. Nexter Blocks uses the current product context from each loop iteration, so the Product Compare block can render a unique toggle for every card. The key detail is setting Type to Action Button inside a reusable block or adding it as an inner block in Custom Skin.

What’s better for product comparison: Count Badge or Action Button?

Count Badge fits global entry points like headers because it shows how many products are queued for comparison and opens the modal when clicked. Action Button fits catalog cards because it creates a per-product toggle inside a WooCommerce Post Listing loop. The decision comes down to placement: global navigation uses Count Badge, while individual product cards use Action Button.

How wide should the comparison modal be for products with lots of specs?

The Modal Max Width field goes from 400px to 1600px, and wider values matter when you are comparing products with many attribute rows. A setting of 1200px or more helps visitors read each column without horizontal scrolling, which is important for spec-heavy stores like electronics or accessories. That keeps comparisons readable instead of cramped.

Last reviewed: September 28, 2026

Related Docs