GTIN missing in Rich Results

#112434
  • Resolved Imran Mughal
    Rank Math free

    Hi there,

    Great tool, so thanks for all the hard work. Also, I’ve just seen the offer for Cyber Monday!

    I’ve been through your forum for the GTIN rich results and although it advises to install the following plugin: https://wordpress.org/plugins/product-gtin-ean-upc-isbn-for-woocommerce/, which I have and populated all the products with the EAN/GTIN codes I still cannot see my rich results come through.

    Is there some configuration or code that I’m missing?
    More info in the details

    Please advise. Thanks

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Could you try by adding the following code at the end of your functions.php file?

    /**
     * Filter to add GTIN to WC Products.
     *
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    	global $product;
    	//$product = RankMath\Helper::get_product();
    	$gtin = $product->get_meta( '_wpm_gtin_code' );
        $entity['gtin12'] = $gtin;
        return $entity;
    });

    Looking forward to helping you. 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 1 replies (of 1 total)

The ticket ‘GTIN missing in Rich Results’ is closed to new replies.