I’ve been searching all over the internet for hours how to automatically assign a category to new products. When you open the new product that the category is selected.
I have two product categories (Books and FIlms) and I would like that every time we open a new product, Books are selected. In this way it will directly show the custom fields of that product category and we will speed up the creation process.
It’s possible?
thanks
UPDATE
I found a code that seems to work with the posts. Any idea how I can adapt the code for products and where should I put the category I care about?
2
Answers
In product categories click the
Make default
action of your desired category to make it as default category. For more details refer the image:You can visit this page using this URL (replace the domain with your domain):
www.example.com/wp-admin/edit-tags.php?taxonomy=product_cat&post_type=product
When it comes to the checkbox that should already be checked when creating a new product, you can use jQuery
Replace
in-product_cat-15
within-product_cat-{YOUR-CAT-ID}