Offers Count (Badge & Shortcodes)

Content Egg can store multiple affiliate offers per post or WooCommerce product. The Offers Count feature displays how many offers are available, which is especially useful on archive and shop pages.

What it does

  • Automatically calculates the total number of offers for each post/product.

  • Stores it so it can be displayed fast anywhere.

  • Lets you show the number via:

    • Shortcode (anywhere you can place shortcodes)

    • Badge output in WooCommerce loops (shop/category/tag/search product grids)

By default, out-of-stock offers are not counted (if the module provides stock status). This can be changed by developers (see below).

Enable Offers Count badge for WooCommerce

  1. Go to Content Egg → Settings → WooCommerce

  2. Choose where the badge should appear: Offers Count Badge Position

Depending on your theme layout, you can display it in different places:

  • Before product title (near image)

  • Inside product title area

  • After title

  • After product item (near button)

  • Disabled (no automatic output)

If your theme uses WooCommerce Blocks (product grid blocks), classic loop hooks may not apply. In that case, use the shortcodes below.

Shortcodes

You can use these on posts/pages, in widgets, page builders, or anywhere shortcodes are supported.

1) Offers count number

Shortcode

This prints a number like:

Optional parameter

  • post_id — show count for a specific post/product

Example:

2) Offers badge

Shortcode

Default output example:

Parameters

  • min — minimum count required to show the badge (default: 1)

  • label — badge label text (default: Offers)

  • class — CSS class for styling (default: cegg-offers-badge)

Examples:

Show only if there are at least 3 offers:

Custom label:

Custom CSS class:

How counting works

Which offers are counted?

  • Offers saved by Content Egg (across all active modules) for the post/product.

  • By default: offers with “out of stock” status are excluded (when stock status is available).

What about posts/products with no Content Egg offers?

  • The badge/shortcodes will display 0 (count shortcode) or nothing (badge shortcode, because min=1).

  • No badge is shown on WooCommerce archives if there are no offers.

Styling the badge

WooCommerce badge styling

When enabled, the WooCommerce badge includes its own minimal styling. You can override it in your theme CSS:

Example:

Shortcode badge styling

Use a custom class:

Then style it:

Developer customization

This section is for developers who want to change how counts are calculated or where badges appear.

Filters

Change the meta key used to store count

Include out-of-stock offers in the count

Modify the final count

Customize badge HTML (shortcode + internal badge builder)

WooCommerce-specific filters

Change where the badge is hooked in the loop

(If you implemented an option for this, the option is preferred. This filter can override it.)

Adjust badge arguments used in WooCommerce loop

Change WooCommerce badge URL (if badge is linked)

Customize WooCommerce badge CSS

Troubleshooting

The badge shows nothing

  • The post/product may have 0 offers.

  • For badge shortcode: min=1 hides the badge when count is 0.

  • Make sure Content Egg has already fetched/saved offers for the post/product.

WooCommerce badge doesn’t appear on my shop page

  • Your theme may use WooCommerce Blocks (block-based product grids) where classic hooks don’t run.

  • Use the shortcode badge in your product grid template, or switch the shop display to classic templates if available.

Counts seem outdated

  • Counts update when Content Egg updates offer data for a post.

  • If your site has many existing posts created before this feature, run the rebuild (or update offers on those posts).

Last updated