Hello,
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,