mistercode
Forum Replies Created
-
Forum: Plugins
In reply to: [Yoast SEO] link rel even if no previous or next pageThank you @maybellyne for your reply.
Based on the provided Workaround I have developed the following code:
/** * Removes rel next/prev links on shop and product category page without products * * @param $link * * @return false|mixed */ function my_remove_wpseo_rel_link( $link ): mixed { $display_type = woocommerce_get_loop_display_mode(); // 'subcategories' === $display_type indicates there are no products on this page if ( ( is_shop() || is_product_category() ) && 'subcategories' === $display_type ) { return false; } else { return $link; } } add_filter( 'wpseo_next_rel_link', 'my_remove_wpseo_rel_link' ); add_filter( 'wpseo_prev_rel_link', 'my_remove_wpseo_rel_link' );
This code takes into account that the
<link ...>
is retained on pages with products, but removed on pages without products.Thank you @saffiretech for your reply and effort to fix the issue.
I’m happy to report evything works as expcted, now.
I wish you all the best!
Thank you @saffiretech for your reply and work. I was out so, I had just today the chance for testing.
I’ve updated the plugin and unfortunately the problem still exists.
Please check out this page: https://www.kaerchercentersg.ch/produkt-kategorie/geraete/home-garden/
The first article “Akku-Besen” shows 3 products in this category. However, when you click on the category, only one item is displayed. The other two items are discontinued.
This website is build with the free Astra them. But, I have the same issue on a website with TwentyTwentyThree theme. Both themes use the same WooCommerce category archive page feature.
Could you have a look into this issue again, please?!
Thank you @saffiretech for fixing this.
Regarding the second issues I’m talking about the shop main page. The page has no shortcode and is set under
WooCommerce > Settings > Products > General > Shop page
. The customizer allows you to choose between products, categories or categories and products among each other.Hello @saffiretech. May I ask if you have any update regarding my request?
Thanks!Thank you @saffiretech for your quick reply.
You are referring to the product count here. Right?
Yes, I refer to the product count in the category image.
https://snipboard.io/DOxYhf.jpg
I’m not sure what you are talking about here. When you say “20 items” you mean the count of 20 items or 20 product listing thumbnails are showing up (which shouldn’t have shown up)? Can you share a screenshot or a small video so that we can correctly udnerstand your issue?
Sorry for making this not clear enough: Yes, I mean the product count. I refere to the same image above. There you see a category thumbnail which shows a count of 20. But this category has 20 discontinued products and I do not want to show the discontinued products in the catalog. So, when I click on this category thumbnail I get a no products found message.
I’ll try to summarize this a bit more: The product count is wrong when I disable “Show Discontinued products in WooCommerce catalog?”
https://snipboard.io/z8MOY2.jpg
I would expect that with this setting the discontinued products would not be counted as products in this category. If I have 20 products in the category and 5 are discontinued, the count should be 15. If the result of the count is 0, the category should not be displayed.
Could I explain it better, now?