I dont use Woccomerce How to add SKU in Wordpress page

#39819
Viewing 5 replies - 1 through 5 (of 5 total)
  • Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    You can use the following filter on your theme with some custom logic to load pass the SKU and aggregateRating values to your product schema:

    /**
     * Filter to add Brand Name for Products.
     *
     * @param array $entity Snippet Data
     * @return array
     */
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    	
    	$entity['aggregateRating']['ratingValue'] = '4.5';
    	$entity['aggregateRating']['reviewCount'] = '4.5';
    	$entity['sku'] = '';
    	$entity['review']['reviewRating']['ratingValue'] = '4.5';
    	$entity['review']['reviewRating']['bestRating'] = '5';
    	
        return $entity;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​

    Medha Cloud
    Rank Math free

    Thanks for you response. My apologies I am non developer person. Could please help me on which file do i need to add this code.

    Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    Unfortunately this code will not work on its own, I can suggest that you hire a developer that might be able to help introduce some custom fields to your custom products post type. You will then be able to enter a unique SKU value for your product and then you can pass the values to the filter I shared earlier to fix this.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Medha Cloud
    Rank Math free

    Could you please suggest someone?

    Michael Davis
    Rank Math pro

    Hi Medha,

    Thanks for the reply.

    I can suggest that you reach out to the guys from https://codeable.io/ or a developer from https://www.fiverr.com/

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

The ticket ‘I dont use Woccomerce How to add SKU in Wordpress page’ is closed to new replies.