Thread Starter
ToPpS
(@topps)
Another option is
add_filter( ‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
global $post;
$entity[‘mpn’] = get_post_meta( $post->ID, ‘mpn_meta_key’, true ); // Please hange mpn_meta_key with the meta from which you want to get the MPN value.
return $entity;
})
Hello,
We do not control the output of the WooCommerce products beyond the vendor-related extras. Such as seller info and sold by. You would need to create a brand attribute and then map it as you require.
You just need to follow the instructions provided by Rankmath.
cheers,
Jamie.
Thread Starter
ToPpS
(@topps)
Thanks Jamie.
I appreciate the standpoint.
Would you let me know the correct WCVendor related entity to index?
ie: Vendor Display Name specifically.
Hi @topps
Sorry, I think I missed your original point. Are you wanting to use the store shop name as the brand in Rank Math SEO?
cheers,
Jamie.
Thread Starter
ToPpS
(@topps)
Hi Jamie.
Yes. The marketplace is made up of handmade goods, so in this case, the vendor will be the Brand.
Hi @topps
It seems my reply yesterday didn’t send. Please try this code snippet, I believe it’ll do what you require.
https://gist.github.com/digitalchild/4fcb71d144d7efdba14af2f9d85269a9
I have tested it on my local install and it uses the Vendor store name as the brand.
cheers,
Jamie.
Thread Starter
ToPpS
(@topps)
Hi Jamie,
I appreciate the effort.
I added the code to my functions.php file and tested it on this side. The good news is that the site didn’t crash with the new code. 🙂
However, the ability to set the brand as the vendor store name wasn’t available in the drop-down options under Rank Math, General Settings, WooCommerce.
I tested all the available options by reviewing the resultant page source code and Product:brand schema is not pulling through the vendor store name.
Best wishes,
Anthony
Thread Starter
ToPpS
(@topps)
Wouldn’t the wcvendors_cart_sold_by_meta work?
Hi @topps
This sets the brand in code automatically. I tested this on the single product pages for the vendor products. It is outputting the brand as the vendor store name.
Can you send in an email to our pre-sales and I’ll take a further look for you.
Just mention this forum post in the contact.
cheers
Jamie.
Thread Starter
ToPpS
(@topps)
Hi Jamie,
Continued testing with the google markup tool: https://search.google.com/structured-data/testing-tool#
Seems the issue was that the “Shop Name” wasn’t set for the one vendor under the WP Users settings.
Thank you for the help on this one.