Change Attribute Group Layout for Products or Categories

You can change the group attributes layout for custom single products or categories with the below filter.

In this example the product ID 87 gets the layout 2 and the product with the ID 333 the layout 3.

function modify_group_attributes_layout( $layout, $product_id) {

	if($product_id == 87) {
		$layout = 2;
	}
	if($product_id == 333) {
		$layout = 3;
	}
    return $layout;
}
add_filter( 'woocommerce_group_attributes_layout', 'modify_group_attributes_layout', 10, 2 );

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *