I am trying to add the Brand Name to rich data in Woocommerce. Before i used the code below, but Google has updated their guidance on how to do this. It used to be "Brand":"Brandname"; but they changed it to: “brand”: {“@type”: “Brand”, “name”: “Brandname”}.
Could somebody help me adjust the code below to include the new markup structure?
function custom_woocommerce_structured_data_product ($data) {
global $product;
$data['Brand'] = $product->get_attribute('Fabrikant') ?? null;
$data['mpn'] = $product->get_sku() ?? null;
return $data;
}
add_filter( 'woocommerce_structured_data_product', 'custom_woocommerce_structured_data_product' );
source https://stackoverflow.com/questions/73574550/add-brand-type-to-woocommerce
No comments:
Post a Comment