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

# Hooks and filters

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

Table of Contents

 [Toggle](#)

- [formafern_swatch_attributes](#formafern_swatch_attributes)
- [formafern_swatch_max_options](#formafern_swatch_max_options)
- [formafern_dimension_labels](#formafern_dimension_labels)
- [formafern_note_attributes](#formafern_note_attributes)
- [formafern_filter_chip_attributes](#formafern_filter_chip_attributes)

## `formafern_swatch_attributes`

The attributes whose options show as swatches on product cards, in order of preference: the first one a product's variations use, with at least two options, wins. Attribute slugs without the `pa_` prefix. Default `finish`, `wood-finish`, `upholstery`, `fabric`, `colour`, `color`, `glaze`, `leg-colour`, `leg-color` and `material`.

```
add_filter( 'formafern_swatch_attributes', function ( $names ) {
	array_unshift( $names, 'frame-colour' );
	return $names;
} );
```

## `formafern_swatch_max_options`

On the product page, variation option lists with this many options or fewer show as buttons; longer lists stay as a dropdown. Default `8`.

```
add_filter( 'formafern_swatch_max_options', function () {
	return 12;
} );
```

## `formafern_dimension_labels`

The labels of WooCommerce's three dimensions in the furniture details, keyed `length`, `width` and `height`. Default **Width**, **Depth** and **Height**: furniture's width is WooCommerce's length.

```
// Keep WooCommerce's own names.
add_filter( 'formafern_dimension_labels', function () {
	return array(
		'length' => __( 'Length', 'my-shop' ),
		'width'  => __( 'Width', 'my-shop' ),
		'height' => __( 'Height', 'my-shop' ),
	);
} );
```

## `formafern_note_attributes`

The attributes that get their own section in the furniture details instead of a row under Materials and specifications. An array of section key (`care`, `assembly`, `warranty`, `delivery`) to attribute slugs. Default:

| Section | Attribute slugs |
| --- | --- |
| `care` | `care`, `care-instructions` |
| `assembly` | `assembly` |
| `warranty` | `warranty`, `guarantee` |
| `delivery` | `lead-time`, `dispatch`, `delivery`, `delivery-time` |

```
add_filter( 'formafern_note_attributes', function ( $sections ) {
	$sections['care'][] = 'cleaning';
	return $sections;
} );
```

## `formafern_filter_chip_attributes`

The attribute slugs whose catalog filter options show as chips instead of a checklist. Default `size`, `width`, `seats`, `rug-size` and `bed-size`.

```
add_filter( 'formafern_filter_chip_attributes', function ( $slugs ) {
	$slugs[] = 'drawers';
	return $slugs;
} );
```
