Notice on Categories
-
Good Morning,
is it possible to show notes on categories? Since I have almost 20,000 products, I would like to only show the notes on certain categories. Is that possible? Or is there perhaps a premium plugin?
Best regards
Carsten
-
Hi @carstenwh,
Are you using the most recent version of the plugin? We recommend that you update the plugin to its latest version.
Starting version 1.2.0, the plugin allows you to show the Global notice on selected product categories and tags. Head over to the Display Rules to show a notice section on Product Notices page under WooCommerce Settings. Check the screenshot here.
Once you enable the
Enable Rules
checkbox you will be able to choose categories and/or tags to show the product notices on.Let us know in case this helps.
Hi,
thank you very much it works great. Can you possibly make the box a little smaller?
Best regards
CarstenHi @carstenwh,
Great to learn that it worked for you. Feel free to make changes to the notice box style as you like, using custom CSS.
Check out this article to understand how you can add custom CSS to your website: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/.
Marking this topic as resolved. Let us know in case you need help with anything else. Thanks.
Thanks alot. The plugin works really great.
Hi,
thanks again for the great plugin. Is it actually possible to select a main or upper category and the setting is inherited by all lower ones?
Best regards Carsten
Hi @carstenwh,
Currently this is not possible directly. You will need to manually select categories to display notice(s) on.
But that does sound like a great feature to have in the plugin. So, why not. We will be adding this to our development roadmap. Keep an eye on the plugin changelog when the new version drops in.
Good Morning,
Thank you for the great feedback. But you probably can’t say exactly when this feature could come? Best regards Carsten
Hi @carstenwh,
The plugin feature roadmap can be found here: https://cloudredux.com/cr_plugins/product-notices-for-woocommerce/. Rest assured, we are working to make the plugin more and more usable for you.
For now, you can use the code below to show the global notice on all child categories of each selected category from plugin settings page:
<?php remove_action( 'woocommerce_single_product_summary', 'crwcpn_global_product_notice_top', 12 ); add_action( 'woocommerce_single_product_summary', 'crwcpn_global_product_notice_top_withChildCategories', 12 ); /** * Display Global product notice on parent categories and child categories of selected categories. */ function crwcpn_global_product_notice_top_withChildCategories() { $global_notice_use_display_rules = get_option( 'crwpcn_global_product_notice_use_display_rules' ); if ( 'yes' === $global_notice_use_display_rules ) { global $post; $product = wc_get_product( get_the_ID() ); $product_categories = $product->get_category_ids(); $product_tags = $product->get_tag_ids(); $selected_product_categories = get_option( 'crwpcn_product_notice_display_by_categories' ); $selected_product_tags = get_option( 'crwpcn_product_notice_display_by_tags' ); $in_selected_categories = array(); foreach ( $selected_product_categories as $parent_categories ) { $crwpcn_child_categories = get_term_children( (int) $parent_categories, 'product_cat' ); if ( ! empty($crwpcn_child_categories)){ $all_selceted_categories = array_merge( $selected_product_categories, $crwpcn_child_categories ); $all_unique_categories = array_unique( $all_selceted_categories ); $intersect_count = count(array_intersect( $all_unique_categories, $product_categories )); if ( 0 != $intersect_count ) { $in_selected_categories[] = array_intersect( $all_unique_categories, $product_categories ); } } else { $intersect_count = count(array_intersect( $selected_product_categories, $product_categories )); if ( 0 != $intersect_count ) { $in_selected_categories[] = array_intersect( $selected_product_categories, $product_categories ); } } } $in_selected_tags = array_intersect( $selected_product_tags, $product_tags ); if ( ! empty( $in_selected_categories ) || ! empty( $in_selected_tags ) ) { echo crwcpn_get_global_product_notice(); } return; } echo crwcpn_get_global_product_notice(); }
You should add this code to your theme’s functions.php (preferably a child theme) or use a plugin like WP Designer or Code Snippets to add the custom code to your website.
Now when you select a category which has one or more child categories, the global notice would be displayed on all the child categories too.
Let us know if that worked for you. Cheers!
Thank you very much, that’s great. Is there also a possibility if I have to display the notice everywhere at short notice? Best regards Carsten
Or maybe the possibility on which pages it should not be?
Hi @carstenwh
Sure, you can add any condition(s) as needed in the code snippet or in fact tweak the snippet completely suited to your requirements of displaying the notice and it should work like a charm!
And yes, the detailed ability to control the display of notice products, categories, tags, etc. will be added to the plugin features soon! So, stay tuned.
- The topic ‘Notice on Categories’ is closed to new replies.