Hello,
Thank you for contacting Rank Math.
You can use filter hooks to add/edit the SKU in your product schema. Please check the sample code below.
You need to add it to your functions.php in your theme files.
/**
* Filter to change the schema data.
* Replace $schema_type with schema name like article, review, etc.
* @param array $entity Snippet Data
* @return array
*/
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
$entity['sku'] = 'Your-Global-Indetifier';
return $entity;
});
Let us know if this helps.
Looking forward to your update.
Thank you.
Thanks that helps. I changed it a bit to make it work for me:
/**
* Filter to change the schema data.
* Replace $schema_type with schema name like article, review, etc.
* @param array $entity Snippet Data
* @return array
*/
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
$entity['mpn'] = $entity['sku'];
return $entity;
});
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.