Esclude WooCommerce Category from Product -> Search Console

  • Hi,
    after last update of rankmath i received again all errors of several missing fields (price, url, aggregate rating , etc…).

    In my setting i have set Remove Schema Markup on Shop Archives -> to YES.

    Before update there was not errors for categories.
    All links affected are showed in this way:

    https://sitename.com/cat/riscaldamento/termoregolazione/
    etc…

Viewing 15 replies - 1 through 15 (of 15 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.

    You can fix the SKU and availability issue easily as well:

    To fix the brand warning, head over to WordPress Dashboard > Rank Math > General Settings > WooCommerce and choose from any of the available fields to use as your product’s brands.

    Brand Value

    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.

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

    Hi,
    thanks for your reply.

    But as indicated the problem is not for the products.
    Here i have all informations inserted and work fine.

    But Search console indicated problems on categories.
    They are not excluded from rich snippet.

    Please Let me know
    Thanks

    Hello,

    Could you try to put this code at the end of your functions.php file in your current theme?

    /**
     * Code to remove json+ld data
     * 
     */
    add_action( 'rank_math/head', function() {
    	global $wp_filter;
            if(is_product_category()){
    	    if ( isset( $wp_filter["rank_math/json_ld"] ) ) {
    		unset( $wp_filter["rank_math/json_ld"] );
    	    }
            }
    });

    If that still doesn’t work, could you share your login credentials? To do that, 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,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Please take a look on screen
    Categories Error GSC

    Thanks

    • This reply was modified 2 weeks, 1 day ago by Marco.
    • This reply was modified 2 weeks, 1 day ago by Marco.

    Hi Marco,

    Please check this screenshot where we enabled only Rank Math and WooCommerce in the troubleshooting mode:

    Here is the end result showing no warnings or errors or even the product Schema on the product category archives which is how it should show up:

    That means something else on your website is causing all those warnings.

    Then, we only disabled Rank Math and your website still throws the errors you are reporting. I have recorded a screencast and shared the same with you in your sensitive data section.

    Please check.

    This means there is something else causing all these warnings.

    To determine that, please follow this troubleshooting guide:
    https://rankmath.com/kb/check-plugin-conflicts/

    Please let me know if you find the culprit.

    Only the site admin would know and your users won’t be affected by this troubleshooting.

    Looking forward to helping you.

    Thanks for your reply,
    i will investigate.

    Instead what about the seo analisys ?
    Have you see ?
    Thanks

    As you notice in the screencast,
    i have disabled all except woocommerce and rankmath,
    so i have all that warning in the categories page.

    is there a way to pass these values by using some hooks in the function.php ?

    In past i have used this filter
    add_filter( ‘rank_math/snippet/rich_snippet_product_entity’, function( $entity ) {
    if ( is_singular( ‘product’ ) ) {

    }
    }

    to pass brand, ean, PriceValidUntil on the product page.
    I have tried to use the same for category but not pass the data.

    Can you suggest me something ?
    Thanks

    Hello,

    The category pages usually acquire their schema content from the related post/product pages in the category. The code you are suggesting can only be used to edit schema entities and the product categories are not assigned any schema by themselves.

    Were you able to follow the provided troubleshooting guide to find the plugin causing the warnings?

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hi,
    thanks for your reply.

    Since you have tell me that you have tested with only woocommerce enabled,
    and you see the error, i have not tested to disable all other plugin.

    Or you have only disabled rank math ?
    Please Let me know
    Thanks

    Hello,

    I have run a number of tests on your site and I have confirmed the option to remove schema in product categories by Rank math is working just fine. The product schema in your category pages is being generated by your theme(Electro). Please get in touch with your theme provider to guide you on how to disable or remove this. Let us know how this goes.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hi,
    after investigating i have see that the error is not related to the theme, but in woocommerce itself.

    i have insert the following code to exclude category but nothing.

    function wc_unlimit_product_structed_data( $is_archive_page ) {
    	return false;
    }
    add_filter( 'woocommerce_structured_data_product_limit', 'wc_unlimit_product_structed_data', 10, 1 );

    so, in past i have inserted this code from rankmath

    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
    ...
    if($gtin_value){
    			$entity['gtin8'] = $gtin_value;
    			$entity['ean'] = $gtin_value;
    }
    ...
    }

    to add other params like GTIN, BRAND, ETC…

    can you provide also some function to add entity markup in archive pages or disable from categories ?
    Thanks

    Hello,

    You seem to have deactivated the provided access. The following is a filter you should use for teh Global identifier issue.

    /**
    * Filter to add GTIN to Variable Products.
    *
    * @param array $entity Snippet Data
    * @return array
    */
    add_filter( 'rank_math/snippet/rich_snippet_product_entity', function( $entity ) {
       if(is_product()){
         $product = new WC_Product( get_the_ID() );
         if( $product->is_type( 'simple' ) ){
           $gtin_value = get_post_meta($product->get_id(),'_wpm_gtin_code', true);
           $entity['gtin8'] = $gtin_value;
         }elseif($product->is_type( 'variable' )){
           $variation = new WC_Product_Variation(get_the_ID());
           $gtin_value = get_post_meta($variation->get_id(),'_wpm_gtin_code', true);
           $entity['gtin8'] = $gtin_value;
         }
       }
       
       return $entity;
    });

    To remove the schema from your product categories, there is a provided option which you can enable in Rank math > Titles & Meta > Product categories:

    imgg

    Hoping that helps you. Thank you.

    ​​​​​​​

    Hi,
    thanks for your reply.
    i have restored data access.
    Please advice.

    About Rank math > Titles & Meta > Product categories
    this is already disabled but not work.

    Please,
    any news?

Viewing 15 replies - 1 through 15 (of 15 total)

You must be logged in to reply to this ticket.