If you run a WooCommerce store, adding a Merchant Return and Shipping policy to your Schema markup will further enhance your rich snippet. Google offers several ways to add this data, including Google Merchant Center, etc., and Schema Markup is one among them.
In this knowledgebase article, we will walk you through how to add them to your Online Store using Rank Math to become eligible for these rich results.
You can add the merchant return policy at the Organization level as well as the product level. However, note that your product-level markup would override your organization-level markup.
How to Add Merchant Return Policy at Organization Level PRO
If your business or online store has a standard return policy, then you may consider adding that using our Schema Templates, which is available only in the PRO version of Rank Math. If you haven’t already, you can choose a PRO subscription of your choice from here.
Note: Before you get started, ensure that you have your Schema module enabled at Rank Math → Dashboard → Modules.
Start by heading over to Rank Math SEO → Schema Templates and then click the Add New Schema button here. In the popup that appears on the screen, choose Custom Schema Builder.
Next, in the Schema Builder, use the Add Property and Add Property Group options to add the MerchantReturnPolicy Schema, as shown below.
Please feel free to adjust the values according to your website. You can also refer to the documentation from Google for configuring this Schema.
Then head over to the Display Conditions tab, where you can choose to Insert this custom Schema into the Organization Schema, as shown below. Finally, click the Save button.
How to Add Merchant Return and Shipping Policy at the Product Level
To add the Merchant Return and Shipping policy at the product level, you can add the below filter to your website theme’s rank-math.php
file. If you haven’t already created a rank-math.php
file, you can refer to this tutorial to create one.
Please feel free to customize the filter with the values relevant to your WooCommerce store. You can refer to this documentation from Google to understand the accepted values.
The below filter adds this Merchant Return and Shipping policy to all your simple products, but you can also further customize this filter with conditions to change them for specific products.
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
// Return policy
$entity['offers']['hasMerchantReturnPolicy']['@type'] = 'MerchantReturnPolicy';
$entity['offers']['hasMerchantReturnPolicy']['applicableCountry'] = 'US';
$entity['offers']['hasMerchantReturnPolicy']['returnPolicyCountry'] = 'US';
$entity['offers']['hasMerchantReturnPolicy']['returnPolicyCategory'] = 'https://schema.org/MerchantReturnFiniteReturnWindow';
$entity['offers']['hasMerchantReturnPolicy']['merchantReturnDays'] = 7;
$entity['offers']['hasMerchantReturnPolicy']['returnMethod'] = 'https://schema.org/ReturnByMail';
$entity['offers']['hasMerchantReturnPolicy']['returnFees'] = 'https://schema.org/FreeReturn';
$entity['offers']['hasMerchantReturnPolicy']['refundType'] = 'https://schema.org/FullRefund';
// Shipping details
$entity['offers']['shippingDetails']['@type'] = 'OfferShippingDetails';
$entity['offers']['shippingDetails']['shippingRate']['@type'] = 'MonetaryAmount';
$entity['offers']['shippingDetails']['shippingRate']['value'] = 5;
$entity['offers']['shippingDetails']['shippingRate']['currency'] = 'USD';
$entity['offers']['shippingDetails']['shippingDestination']['@type'] = 'DefinedRegion';
$entity['offers']['shippingDetails']['shippingDestination']['addressCountry'] = 'US';
$entity['offers']['shippingDetails']['deliveryTime']['@type'] = 'ShippingDeliveryTime';
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['@type'] = 'QuantitativeValue';
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['minValue'] = 0;
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['maxValue'] = 1;
$entity['offers']['shippingDetails']['deliveryTime']['handlingTime']['unitCode'] = 'DAY';
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['@type'] = 'QuantitativeValue';
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['minValue'] = 0;
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['maxValue'] = 3;
$entity['offers']['shippingDetails']['deliveryTime']['transitTime']['unitCode'] = 'DAY';
return $entity;
});
However, if you have variable products, you can use the following filter to add this Merchant Return and Shipping policy to them. You can still customize this filter specifically.
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
if ( empty( $data['richSnippet'] ) || ! in_array( $data['richSnippet']['@type'], [ 'Product', 'ProductGroup' ] ) ) {
return $data;
}
$data['shippingDetails'] = [
'@context' => 'https://schema.org/',
'@type' => 'OfferShippingDetails',
'@id' => '#shipping_policy',
'deliveryTime' => [
'@type' => 'ShippingDeliveryTime',
'handlingTime' => [
'@type' => 'QuantitativeValue',
'minValue' => 0,
'maxValue' => 1,
'unitCode' => 'DAY',
],
'transitTime' => [
'@type' => 'QuantitativeValue',
'minValue' => 1,
'maxValue' => 5,
'unitCode' => 'DAY'
],
],
'shippingRate' => [
'@type' => 'MonetaryAmount',
'value' => 200,
'currency' => 'PKR',
],
'shippingDestination' => [
'@type' => 'DefinedRegion',
'addressCountry' => 'PK'
]
];
$data['hasMerchantReturnPolicy'] = [
'@context' => 'https://schema.org/',
'@type' => 'MerchantReturnPolicy',
'@id' => '#merchant_policy',
'applicableCountry' => 'PK',
'returnPolicyCategory' => 'https://schema.org/MerchantReturnFiniteReturnWindow',
'merchantReturnDays' => 7,
'returnMethod' => 'https://schema.org/ReturnByMail',
'returnFees' => 'https://schema.org/FreeReturn'
];
if ( 'Product' === $data['richSnippet']['@type'] ) {
$data['richSnippet']['offers']['shippingDetails'] = [ '@id' => '#shipping_policy' ];
$data['richSnippet']['offers']['hasMerchantReturnPolicy'] = ['@id' => '#merchant_policy'];
return $data;
}
if ( empty( $data['richSnippet']['hasVariant'] ) ) {
return $data;
}
foreach ( $data['richSnippet']['hasVariant'] as $key => $value ) {
if ( empty( $value['offers'] ) ) {
continue;
}
$data['richSnippet']['hasVariant'][ $key ]['offers']['shippingDetails'] = [ '@id' => '#shipping_policy' ];
$data['richSnippet']['hasVariant'][ $key ]['offers']['hasMerchantReturnPolicy'] = [ '@id' => '#merchant_policy' ];
}
return $data;
}, 99, 2);
And that’s it! If you have absolutely any questions about adding Merchant Return and Shipping policy, please open a support ticket here and our support team would be more than happy to assist you.