In all e-commerce websites, the shopping page is one of the most important pages. Your customers cannot physically see all the products you sell. Therefore, it is very important to provide store pages so that customers can stay on the website and make purchase decisions. Woocommerce storefront hidden categories this simple tutorial is especially suitable for people who use the woocommerce plug-in to build stores. I’ll show you how to use the woocommerce client to display all product categories on the store page and how to hide the woocommerce categories to avoid displaying them on the store page.
Storefront themes integrate seamlessly with woocommerce. Woocomerce allows you to decide how to display products on the home page of the store front desk theme. How to display categories in the store theme. When you log in to the WordPress website and access the dashboard as an administrator, use the product catalog in shape > Customize > woocommerce to uniquely display the woocommerce shop page. You can choose to display only categories, categories containing goods, or only goods. The summary is as follows:
Product display: lists all products. Show categories: lists all categories. Category and product display: all products and categories will be listed. \
Simple steps to follow include: Log in to the WordPress site and access the dashboard as an administrator. In the panel menu, click shape Menu > theme editor menu. If the theme editor page opens, browse the theme features file to add features to remove the attachments category. functions. Add the following code to the PHP file\/**
*Show only items in the selected category.
*\/
Function get_subcategory_terms ($terms, $taxonomy, $args){
$new_terms = array ();
$hide_category = array (19)\/\/ ID of the category you don’t want to display on the shopping page
\/\/If it is a product category and store page
if ( in_array( ‘product_cat’, $taxonomies ) && ! is_admin() && is_shop() ) {
foreach ( $terms as $key => $term ) {
if ( ! in_array( $term->term_id, $hide_category ) ) {
$new_terms[] = $term;
}
}
$terms = $new_terms;
}
Return $terms;
}
add_filter( ‘get_terms’, ‘get_subcategory_terms’, 10, 3 ); To view the results, refresh the home page. In the screenshot below, you can see that the code deletes the \