Search Console Structured Data missing fiel hasMerchantReturnPolicy

#663526
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    The feature has already been included in our suggestion list, and the developers will assess the situation and provide further feedback on whether or not this could be introduced into the plugin at a later date.

    At the moment, to make changes to the Product Schema to add these would be to use the Schema Templates to extend the markup: https://rankmath.com/kb/schema-templates/#extending-schema

    Alternatively, we have an example filter that would help add these 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 your 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;
    });

    And here’s a guide to adding the code to the website:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps.

    Thank you.

    shout cart
    Rank Math free

    Where do I put the code?

    Hello,

    You can use any of the methods mentioned in this guide to add the filter on your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps and please don’t hesitate to let us know if you have any other questions.
     
    Thank you.

    shout cart
    Rank Math free

    I have a pro version

    This is the code where I put it

    In any file!

    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;
    });

    Hello,

    The code will not and should not be inserted into any file. It must be inserted into a specific file like the theme’s functions.php.

    To make it more manageable, I would suggest the #1 method instead: https://rankmath.com/kb/wordpress-hooks-actions-filters/#code-snippets-plugin

    Also, it seems that you haven’t made any changes to the code. Please note that the code we provided is only a placeholder and you need to change its value that match the data of your product.

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘Search Console Structured Data missing fiel hasMerchantReturnPolicy’ is closed to new replies.