---
title: Hooks and filters
description: The filters Candy Shop provides, with examples.
url: "https://wpruby.com/knowledgebase/candy-shop-hooks/"
updated: "2026-11-04"
category: WPRuby Themes / Candy Shop
---

# Hooks and filters

Candy Shop provides the filters below. Put the code in a [child theme](https://wpruby.com/knowledgebase/candy-shop-child-themes/)'s `functions.php` or in a small plugin.

Table of Contents

 [Toggle](#)

- [candy_shop_new_badge_days](#candy_shop_new_badge_days)
- [candy_shop_product_badges](#candy_shop_product_badges)
- [candy_shop_highlight_attributes](#candy_shop_highlight_attributes)
- [candy_shop_copy](#candy_shop_copy)
- [candy_shop_admin_help_links](#candy_shop_admin_help_links)

## `candy_shop_new_badge_days`

How many days after publishing a product shows the **New** badge. Default `30`; `0` turns the badge off.

```
add_filter( 'candy_shop_new_badge_days', function () {
	return 14;
} );
```

## `candy_shop_product_badges`

The badges a product card shows, as `modifier => label`. Candy Shop adds `best` (*Best seller*) and `new` (*New*); the sale badge is WooCommerce's own. The second argument is the `WC_Product`.

```
// A "Vegan" badge for products in the Dietary term "vegan".
add_filter( 'candy_shop_product_badges', function ( $badges, $product ) {
	if ( has_term( 'vegan', 'pa_dietary', $product->get_id() ) ) {
		$badges['vegan'] = __( 'Vegan', 'my-store' );
	}
	return $badges;
}, 10, 2 );
```

Each badge gets the classes `cs-badge cs-badge--<modifier>`, so you can style a new one in CSS.

## `candy_shop_highlight_attributes`

The product attributes shown as highlights on product pages. Default `array( 'pa_flavor', 'pa_dietary' )`.

```
add_filter( 'candy_shop_highlight_attributes', function ( $taxonomies ) {
	$taxonomies[] = 'pa_occasion';
	return $taxonomies;
} );
```

## `candy_shop_copy`

The wording the header and footer patterns use, by key: `announcement`, `announcement_link`, `shop_button`, `search_label`, `search_placeholder`, `footer_pitch`, `newsletter_title`, `newsletter_button`, `filters_title`, `category_filter` and `footer_categories` (the category slugs listed in the footer's Shop column).

```
add_filter( 'candy_shop_copy', function ( $copy ) {
	$copy['announcement'] = 'Free delivery on orders over $40';
	return $copy;
} );
```

The wording is used when the header or footer is drawn from the pattern. A header or footer you've already edited and saved in the Site Editor keeps its own text.

## `candy_shop_admin_help_links`

The Documentation, Get support and Your WPRuby account links on **Appearance → Candy Shop**, as an array with the keys `docs`, `support` and `account`.
