Missing field ‘hasMerchantReturnPolicy’ (in ‘offers’)

#602026
  • Resolved Ian Barber
    Rank Math free

    Hi

    I am using Woocommerce and the RankMath Woocommerce Schema

    In my Google search console, I am see Warning for both

    Missing field ‘hasMerchantReturnPolicy’ (in ‘offers’)
    Missing field ‘shippingDetails'(Optional)

    I have looked everywhere as to where I can place this information but cannot find it, please can you assist me?

    Do I need to add a filter to my theme functions PHP?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math support and we apologize for the inconvenience.

    These fields are related to the shipping and return information for your products, which Google recently added to its Merchant Listings report. You can learn more about them here: https://developers.google.com/search/blog/2023/04/shipping-and-returns-information

    Our developers are discussing this internally to get all the technical info correct and the best approach to possibly include this in the future.

    Since this feature is still not available in the plugin, the only possible way would be to edit the following filter with the appropriate data for these properties so it gets included in the Product Schema as well: https://rankmath.com/kb/filters-hooks-api-developer/#change-post-schema-data

    We have created an example filter that would help add this data and it assumes that the refund policy is only applicable to the USA and that it has a 30-day refund period.

    The shipping rate section, also assumes a flat fee of 5$ to ship within the United States.

    This would need to be changed according to the website specifications but it should be a good starting point:

    
    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']['returnPolicyCategory'] = 'https://schema.org/MerchantReturnFiniteReturnWindow';
        $entity['offers']['hasMerchantReturnPolicy']['merchantReturnDays'] = 30;
        $entity['offers']['hasMerchantReturnPolicy']['returnMethod'] = 'https://schema.org/ReturnByMail';
        $entity['offers']['hasMerchantReturnPolicy']['returnFees'] = 'https://schema.org/FreeReturn';
    
        // 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';
    
        return $entity;
    });
    

    Regarding the attributes missing from the Schema, the only ones missing are the ones that are set as variations and our plugin excludes those by default.

    Don’t hesitate to get in touch if you have any other questions.

    Hello
    Thanks for supplying the filters

    Is is possible to use the Advance Schema Generata in RankMath to create a template with all this extra data?

    Ian

    Hello,

    Yes, with Rank Math PRO, you can create a schema template to apply all of those to your product.

    Here’s a link for more information about the Schema Templates feature:
    https://rankmath.com/kb/schema-templates/

    Hope that helps.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘Missing field ‘hasMerchantReturnPolicy’ (in ‘offers’)’ is closed to new replies.