Home › Forums › WoodMart support forum › How to put in certain content for a category as a whole
How to put in certain content for a category as a whole
- This topic has 4 replies, 2 voices, and was last updated 4 hours, 1 minute ago by
hey3212.
-
AuthorPosts
-
April 7, 2025 at 5:39 am #652017
hey3212ParticipantHi,
I want to display ”Upcoming Soon'” for the category Bracelets as a whole when a user hit that section from the home page. How to do this?
Attachments:
You must be logged in to view attached files.April 7, 2025 at 11:23 am #652080
Aizaz Imtiaz AwanKeymasterHello,
It looks like you’re aiming to display a custom message like “Upcoming Soon” when there are no products assigned to a category, and the default WooCommerce message is “No products were found matching your selection.”
To display the “Upcoming Soon” message for all product categories when there are no products in the category, you can modify the code to work for all categories. Try to add the following code in function.php of the theme.
// Display "Upcoming Soon" message for all product categories when no products are found function display_upcoming_soon_message_for_empty_categories() { if ( is_product_category() && ! have_posts() ) { // Remove the default WooCommerce message remove_action( 'woocommerce_no_products_found', 'wc_no_products_found', 10 ); // Display custom "Upcoming Soon" message echo '<h2 class="upcoming-soon-message" style="text-align: center; color: #FF6347; font-size: 24px; font-weight: bold;">Upcoming Soon</h2>'; } } add_action( 'woocommerce_archive_description', 'display_upcoming_soon_message_for_empty_categories', 20 );
You can also enable Maintenance Mode in WooCommerce by navigating to the Settings section and adjusting the site visibility.
Navigate to > WooCommerce Settings > Site visibility and choose the coming soon: https://ibb.co/xK4WvNDJ
Best Regards,
April 7, 2025 at 11:37 am #652087
hey3212ParticipantHi,
Thanks for your reply. You said ”Try to add the following code in function.php of the theme.” Where to find the “function.php of the theme”? How to navigate to this location to add the code?
April 7, 2025 at 1:19 pm #652139
Aizaz Imtiaz AwanKeymasterHello,
Navigate to Appearance > Theme File Editor > On the right side, you’ll see a list of theme files. Look for:
Theme Functions (functions.php)
Click on functions.php to open it.
Scroll to the bottom and paste the code you received.
Click the Update File button to save changes.
See the Screenshot for a better understanding: https://ibb.co/zV3Hyyjy
Best Regards,
April 7, 2025 at 1:29 pm #652145
hey3212ParticipantAwesome. This has solved my problem. Thanks a lot!
-
AuthorPosts
- You must be logged in to create new topics. Login / Register