Missing fields Woocommerce Product Schema

#875607
  • Resolved Alper B.
    Rank Math pro

    Hi,

    I realized that we are getting non-critical issues like in GSC:

    offers
    Missing field “shippingDetails” (optional)
    Missing field “hasMerchantReturnPolicy” (optional)

    I know that WooCommerce Product Schema is integrated with WooCommerce and generates the data automatically. But at the same time, we can use filters for Rankmath, right?

    What would the filter be for digital products with no shipping or return policy as these products are non-refundable, instant downloads?

    Thank you for your time and help!

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

    Thank you for contacting Rank Math support.

    If you’re selling a digital downloadable product then you do not need to add these fields, as they’re optional fields. If you decide to add the fields, you can use a zero shipping rate, i.e.

              "shippingRate": {
                "@type": "MonetaryAmount",
                "value": 0,
                "currency": "USD"
              }

    For returns, you can use MerchantReturnNotPermitted to indicate that return is not permitted.

    Here’s an example filter:

    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/MerchantReturnNotPermitted';
        $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'] = 0;
        $entity['offers']['shippingDetails']['shippingRate']['currency'] = 'USD';
        $entity['offers']['shippingDetails']['shippingDestination']['@type'] = 'DefinedRegion';
        $entity['offers']['shippingDetails']['shippingDestination']['addressCountry'] = 'US';
    
        return $entity;
    });

    You can add the code to your site using any of the methods here.

    We hope this helps you resolve the issue. Don’t hesitate to contact us again with any other questions or concerns regarding Rank Math. We are always happy to help.

    Thank you for choosing Rank Math!

    I will give it a try! Thank you!

    Hello,

    Once you’ve implemented this, please update the ticket to keep us informed on your progress.

    Thank you.

    After adding the filters, the following issue still pops up:

    shippingDetails
    Missing field “deliveryTime” (optional)

    Just wanted you to know.

    Thank you!

    Hello,

    Remove the previous code and add this one instead:

    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/MerchantReturnNotPermitted';
        $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'] = 0;
        $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;
    });

    Don’t hesitate to let us know if you need help with anything else.

    I will give it a try and update you guys! Thank you!

    Hello,

    If you need help with anything else, please do let us know.

    Best,

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

The ticket ‘Missing fields Woocommerce Product Schema’ is closed to new replies.