-
Hello there,
I need to add more than one GTIN identifier to the product. Let’s say that I want to add both of MPN and UPC, how can I do that ?
-
Hello,
Thank you for contacting Rank Math and bringing your concern to our attention.
As my colleague asked on your previous ticket, can you please search and forward a receipt from FastSpring.com so we can locate your account and verify it?
To add more GTIN or modify the schema, you can use and customize this filter:
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) { // Create the functionality to add the GTIN here return $entity; });The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-phpLet us know how it goes. Looking forward to helping you.
Thank you.
i need to add another field, let’s say i need to add another field for MPN
Kindly give me the full code ready to be add to the websiteHello,
As you’re using a feature of PRO version of Rank Math, we can’t provide you support unless we verify the purchase.
Please search and forward a receipt from FastSpring.com so we can locate your account and verify it.
We’re looking forward to hearing back from you.
Thank you.
Kindly let me know how can i send you the receipt!
can i confirm with you the email of purchase ? or what should i do now ?Hello,
Yes, you can share the email address you used to purchase. If you’ve the receipt from FastSpring, you can upload it to online and share us the URL in the sensitive data section.
You may also share the URL of the receipt from FastSpring.
Looking forward to hearing back from you.
Thank you.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hello,
Thank you for sharing the purchase information and verifying the account.
In order to add both MPN and UPC, please try adding the filter I’ve shared below:
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) { $entity['mpn'] = 'YOUR_MPN'; $entity['upc'] = 'YOUR_UPC'; return $entity; });Let us know how it goes. Looking forward to helping you.
Thank you.
it’s not working dear, you can check the screenshot here
Hello,
The filter I’ve shared above won’t add any field on front-end. It’ll add a global value for MPN, UPC in the Schema. You can verify it by viewing your page source code.
However, Rank Math doesn’t support to add multiple global identifier. But you can add an additional field in the Inventory by using plugin like this:
https://wordpress.org/plugins/woo-add-gtin/If you’re using the plugin I’ve mentioned above, please add the following filter in order to add MPN in the Schema:
add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) { global $product; $entity['mpn'] = get_post_meta( $product->get_id(), 'hwp_product_gtin', true ); return $entity; });The default label for the additional field is set to GTIN by default on the plugin. But you can change the label to MPN by heading over to WooCommerce > Settings > Products > Inventory > Change GTIN Label
Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.
Thank you.
I’ll test this solution and let you know, please don’t close this ticket
Hello,
Sure, we’ll keep this ticket open till your issue gets resolved.
Please do not hesitate to let us know if you need our assistance with anything else.
Thank you.
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.
The ticket ‘I need to add more than one GTIN ?’ is closed to new replies.