Auto Set Sub Category In Wordpress - wordpress

I want to create a new category in WordPress and set an existing category to as the subcategory of the newly created category. Is it possible for WordPress to create a category hook ??
I have tried using the create category hook but am not able to find the solution for it.

Related

Preassigned product category when adding new product in WooCommerce

Tried a lot of different functions to automatically preselect a specific category when clicking "Add new product" in WooCommerce. But nothing works! I just want a specific category to be preassigned when creating a new product. Is there any simple function to functions.php that do this?
To set the default WooCommerce product category, visit the product category page here: Products > Categories. Once there, hover over the category you want to set as default and click on the ‘Make Default’
might as well get rid of the incredibly unuseful Uncategorized product category. If it’s currently set as the default you will need to set another category as default first. Then simply hover over Uncategorized and click delete.

How to display woocommerce product sorting option with a custom wp_query or product list on a custom page template (not product archive)

I have created a custom page template in WP theme and want to show the products list there with sorting option.
I have implemented wp_query to display products but not able to add sorting option for products there.
How can I show sorting option there and filters (woof products filter)?
Use ORDER BY field_name in your query
For example
SELECT * FROM products WHERE type = 'hdd' ORDER BY name

Wordpress - redirecting to product sub-category on separate page

I have a wordpress website and I have shown product categories on my home page using [product_categories columns="2"] shortcode. What I want is when somebody clicks on one of the product categories, it takes them to the product sub-category may be on separate page and I want the sub-categories to be shown exactly like the parent-categories shown on my homepage.
I have already created the sub-categories in my wordpress admin panel but unable to show them on separate page when somebody clicks on parent category. How to achieve that result ?
you can create a taxonomy-product_cat.php file. and where you can get the current category id and use below function to get its clid category
get_term_children( $current_term_id, $taxonomy );
after that you can use clild product category ids to display them
you can use below function to get current product category id
$queried_object = get_queried_object();

wordpress create new menu option in admin for list woocommerce category

I want to create new menu option in admin, for list woocommerce categories. (something like wordpress post list).

Add extra tab like page/post in wordpress for categories/products

I was wondering if there was any plugin or a way to add extra tab in Wordpress admin similar to page/post that would be called categories and inside of it have different categories + subcategories and inside them products? This is not an e-commerce site so I do not want to use woocommerce plugin...
It would look something like that:
Categories (Name of the tab) -> Category1 (ie. Tapes) -> SubCategory (ie. Isolating tapes-> Products
Would apprieciate any help! thank you
Despite that you can't create menu item structure like that you've described in your admin area without some complicated coding, you can create custom post types & custom taxonomies for it.
So, you can have the structure like this one:
Products
- Products
- Product categories
You can make hierarchical categories list & assign any of it to any product.
Please refer to the codex on creation of the custom post & taxonomies
https://codex.wordpress.org/Function_Reference/register_post_type
https://codex.wordpress.org/Function_Reference/register_taxonomy
If you want the plugin, there are plenty of them. For example you can use this one:
https://wordpress.org/plugins/custom-post-type-ui/

Resources