Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ulziibat-n/ece382704845d4b18987a406c22048a7 to your computer and use it in GitHub Desktop.
Save ulziibat-n/ece382704845d4b18987a406c22048a7 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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment