How can I set a brand on a product using Rank Math

#306556
  • Resolved Ginger Ben
    Rank Math free

    Is there a way to add a brand name to a product in my woocommerce, due my google console missing brand data field on most of my products.

    I am only on the free version of Rank Math and don’t have the woocommerce seo plugin.

    I tried to follow this link via your site but could;t seem to get it to work or was unsure it was related to the full version of Rank Math.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    You can customize this filter to add Brand to your product:

    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    	$entity['brand']['@type'] = 'Brand'; 
    	$entity['brand']['name'] = 'Your Brand name';
    	return $entity;
    });

    And here’s a link to how to apply this to your site:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Once done, clear your website’s cache and check the product using Google’s Rich Results test tool.

    I hope that helps.

    Thank you.

    Thanks for your reply, would the filter only add the same brand name to all of my products?

    Hello,

    Yes, that would apply to all pages with the product schema in them.

    If you wish to apply the brand dynamically or in a specific product, you may need to further customize the code. If you are not sure about this, you may hire an expert to create the logic for you.

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘How can I set a brand on a product using Rank Math’ is closed to new replies.