• Resolved mae234

    (@mae234)


    Hello,

    The product review block adds perfectly structured data to the post where the block is inserted. However, “brand” markup is not included in the structured data produced by the product review block. Would you help with that, providing me with a snippet code to add “brand” markup along with other markups generated by the block?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Hardeep Asrani

    (@hardeepasrani)

    Hey @mae234,

    You can use something like this to add more items to the existing schema:

    add_filter( 'otter_blocks_review_block_schema', function( $schema, $attributes ) {
    	$schema['brand'] = array(
    		'@type' => 'Brand',
    		'name'  => 'CheeseMaster'
    
    	);
    	return $schema;
    }, 10, 2 );

    Additionally, you can also use the $attributes object to filter things based on the review block.

    Hope it helps!

    Thread Starter mae234

    (@mae234)

    Thank you for the code. What if I have many posts with product review block, every post has a different product. So how would i assign the right “brand” to each post? Would you advise a code that adds the “brand” field in the block settings?

    Thanks

    Hi @mae234,

    Sorry for the delayed reply!

    You can use the code that can be found here to add multiple brands, depending on the title of each product.

    Have a nice day!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Product Review Block’ is closed to new replies.