-
Hi,
I need help getting the product brand showing in Google search console via woocommerce.
I have set a product attribute named ‘brand’, that I have populated with a different value per product. So it looks like ‘pa_brand’ = value.
I have seen this filter mentioned a number of times in the support forums:
/** * Filter to add Brand Name for Products. * * @param array $entity Snippet Data * @return array */ add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) { $entity['brand'] = 'Rank Math; return $entity; });
However, I can’t get it to pull the product attribute in. If I replace ‘Rank Math’ in the above filter with ‘pa_brand’, it just shows pa_brand in Google structured data testing tool, without pulling in the actual value for that attribute.
I have also tried the script mentioned here:
https://pastebin.com/8m5XU9qP?fbclid=IwAR0CxWnmHCbVkTpoPHhqI6WFnz93ThWhLv1vbsmULq1ZQqRYymEkuDvuDFgBut that doesn’t seem to work either.
I don’t want to use the brand plugins you have mentioned in previous support forum posts as they aren’t very well rated and seem to have issues.
Any help you could provide would be appreciated.
The ticket ‘Use product attribute for brand in structured data’ is closed to new replies.