Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nicomollet/0fdb6941ec17ded0b94d76ab7fc7b7f4 to your computer and use it in GitHub Desktop.
Save nicomollet/0fdb6941ec17ded0b94d76ab7fc7b7f4 to your computer and use it in GitHub Desktop.
WooCommerce: Adds Brand attribute to "Product" Structured Data
<?php
/**
* WooCommerce: Adds Brand attribute to "Product" Structured Data
*
* @param array $data
*
* @return array
*/
function woocommerce_structured_data_product_brand ($data) {
global $product;
$data['brand'] = 'Custom Brand' ?? null;
return $data;
}
add_filter( 'woocommerce_structured_data_product', 'woocommerce_structured_data_product_brand' );
@stephdigiovanni
Copy link

J'ai fait un echo $data['brand'] et ça renvoie bien la marque. Donc soit c'ets un pb de cache soit le filter marche pas. Non ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment