---
title: Filter the WooCommerce ProductGroup schema of variable products
url: "https://www.seopress.org/support/hooks/filter-the-woocommerce-productgroup-schema-of-variable-products/"
lang: en-US
updated: 2026-10-21
hook_name: seopress_pro_wc_product_group_schema, seopress_pro_wc_product_group_max_variants, seopress_pro_wc_product_group_attributes_map
required_version: 10.1
---

# Filter the WooCommerce ProductGroup schema of variable products

- **Hook name:** `seopress_pro_wc_product_group_schema, seopress_pro_wc_product_group_max_variants, seopress_pro_wc_product_group_attributes_map`
- **Required version:** 10.1

```php
<?php
/**
 * Filter the generated ProductGroup schema of a variable product.
 *
 * @param array      $json       ProductGroup schema.
 * @param WC_Product $wc_product Variable product.
 * @param array|null $context    Schema context (null for automatic schemas in the legacy builder).
 * @return array
 */
function sp_wc_product_group_schema( $json, $wc_product, $context ) {
	$json['inProductGroupWithID'] = $wc_product->get_sku();

	return $json;
}
add_filter( 'seopress_pro_wc_product_group_schema', 'sp_wc_product_group_schema', 10, 3 );

// Maximum number of variants embedded in hasVariant (default 50). 0 or less removes the limit.
add_filter( 'seopress_pro_wc_product_group_max_variants', function ( $limit, $wc_product ) {
	return 100;
}, 10, 2 );

// Map variation attribute slugs (without attribute_ / pa_ prefix) to schema.org properties.
add_filter( 'seopress_pro_wc_product_group_attributes_map', function ( $map, $variation ) {
	$map['farbe'] = 'color';

	return $map;
}, 10, 2 );
```

Source: [https://gist.github.com/wp-seopress/cbbfd893924ff2604cebb28e77a1ab9b](https://gist.github.com/wp-seopress/cbbfd893924ff2604cebb28e77a1ab9b)


Default map: color, colour, size, material, pattern.
