EDD product schema have missing fields

#44360
  • Resolved Hossein Mafi
    Rank Math free

    To who it may concern,
    To EDD product schema is active that entering the schema data from Woocommerce parameters and doesn’t allow us to do it manually. The reason for that is some of the fields in EDD are missing (these fields are available in Woocommerce) and we getting a warning in google structured data.
    Could you please help me with that?
    Best regards

    Missing fields:
    ‘priceValidUntil’
    ‘aggregateRating’
    ‘availability’
    ‘review’
    ‘brand’
    No global identifier provided (e.g. gtin, mpn, isbn)

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

    Rank Math takes the schema data from your product pages automatically and turns it into Schema-ready content. Likewise, the aggregateRating and review fields are taken from your actual product reviews that your buyers/customers leave on your products.

    If you don’t have any reviews yet, that is going to show up as a warning in the schema testing tool. That’s because Google will actually look for those fields.

    Please acquire some reviews and ratings to get rid of the aggregateRating and review warnings.

    If these fields are not available in EDD then you could install a third party rating tool that makes it possible to rate your products.

    If you want to use a custom value for your Brands, you can do that by using the following code in your theme’s functions.php file:

    // Add Brand for Products.
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    $entity['brand'] = 'Rank Math;
    return $entity;
    });

    Replace the “Rank Math” text with your actual brand name then run your website through the Structured Data Testing tool once again.

    You can also use a custom fields plugin to add a GTIN field for your products or create some custom logic to populate all these values in your functions.php file like so:

    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    	
            $entity['brand'] = '';
    	$entity['offers']['priceValidUntil'] = '2025-12-31';
    	$entity['offers']['availability'] = 'http://schema.org/InStock';
    	$entity['aggregateRating']['ratingValue'] = '';
    	$entity['aggregateRating']['reviewCount'] = '';
    	$entity['gtin8'] = '123';
    	$entity['review']['reviewRating']['ratingValue'] = '4.5';
    	$entity['review']['reviewRating']['bestRating'] = '5';
    	$entity['review']['author']['name'] = '';
        return $entity;
    });

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

    Afternoon From Jakarta

    I have added that script but eror notice

    Your PHP code changes were rolled back due to an error on line 29 of file wp-content/themes/oceanwp/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘rank_math’ (T_STRING)

    any soluton for this

    Alberto
    Rank Math business

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping 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 ‘EDD product schema have missing fields’ is closed to new replies.