
If you run a shop with WooCommerce you have certainly already discovered the message opposite in Google Search Console under Improvements -> Products.
By default, the WooCommerce plugin for WordPress does not add the “Brand” scheme to WooCommerce product pages. That means there is a loophole in the WooCommerce schema.
Various support threads on WordPress.org and Github say that this can be solved by buying a WooCommerce plugin. With something as basic as this one can be very frustrating, and rightly so.
Ultimately, WooCommerce’s justification is that these are not essential parts of the schema – they only generate warnings in the Google Search Console, but not errors. So in theory, they’re not a big deal.
However, if you want to close this loophole, you have several options. There are “schema plugins” out there to help you patch this up – the Yoast SEO WooCommerce plugin fills the gaps for you – but it is a bit of an exaggeration to spend around 70 euros a year for this. Unless you have or need it for another important reason. Then these instructions will help.
Many people avoid code-based solutions because they have to be “maintained” and break regularly. So for an ecommerce website that makes you money, that’s not great!
Google Search Console fix code – brand field warning
With the Code Snippets plugin , small code snippets like the following can be integrated into the page. Professionals have a separate plug-in for such adjustments or use the functions.php of their theme.
/*
* Füge "Brand"-Schema in die Strukturierten Daten ein
*/
function custom_woocommerce_structured_data_product ($data) {
global $product;
$data['brand'] = ['@type' => 'Brand', 'name' => 'Meine Marke'];
return $data;
}
add_filter( 'woocommerce_structured_data_product', 'custom_woocommerce_structured_data_product' );
If you are the manufacturer of your products or if you only sell goods from one brand, you can insert your brand here instead of ” My brand ” (quotation marks must remain).
Alternatively, the brand can also be extracted from the Brand property with $ product-> read out get_attribute (‘pa_brand’) .
The code snippet would then look like this:
/*
* Füge "Brand"-Schema in die Strukturierten Daten ein
*/
function custom_woocommerce_structured_data_product ($data) {
global $product;
$data['brand'] = ['@type' => 'Brand', 'name' => $product->get_attribute('pa_brand') ?? null];
return $data;
}
add_filter( 'woocommerce_structured_data_product', 'custom_woocommerce_structured_data_product' );
I am using a manufacturer’s product property for a customer. Therefore I set the “Brand” field with the manufacturer with the command $ product-> get_attribute (‘pa_manufacturer’) .
To test the success, use the practical online tool from Google: Test structured data .
Leave a Reply