Skip Navigation

[Résolu] woocommerce product native taxonomies can’t make hierarchical

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: I would like to use a select field to display Product Categories in a CRED form that creates WooCommerce Products, but I can only choose checkboxes.

Solution: Modify the CRED field shortcode to use type "select" and single_select "true".

[cred_field field='product_cat' display='select' single_select='true' output='bootstrap']

Relevant Documentation: https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 réponses, has 2 voix.

Last updated by Christian Cox Il y a 4 années et 2 mois.

Assigned support staff: Christian Cox.

Auteur
Publications
#553079

hi, as said in title, about this issue:
https://toolset.com/forums/topic/displaying-a-taxonomy-cred-field-as-a-dropdown/
as from the user guide:
Click Taxonomies, then Product categories. By default, your product categories will be displayed as a list of check boxes. Replace the display=’checkbox’ with display=’select’ single_select=’true’ to turn your list into a single-choice dropdown
--> this works only for taxonomies created via toolset, not for native? I can't reach native taxonomies via toolset dashboard (when clicking them, it says always 'Wrong Taxonomy specified.' - in each and every installation we have.)
Is there a way to reach that/set that otherwise? Via ftp some php file? It's very ugly on the cred form to have such long checkbox lists...
Thanks a lot!

#553162
tax.jpg

Hi, I'm not sure I understand what you would like to accomplish. It sounds like you have a CRED form that creates Products. You would like to add a taxonomy select field, where the User can select a term from a native WP taxonomy, and this term will be applied to the new Product. Is this correct?

If so, you must first make sure you have associated the native taxonomy with the Product post type. Please see the screenshot. You must check "Products" to associate the native "Categories" taxonomy with the Products post type.

If this is not what you are trying to do, please provide a screenshot showing the "Wrong Taxonomy specified." message in the browser. Please include a large screenshot so I can see the browser URL bar.

#553169

Hi Christian,
the first part of your reply was rather confusing to me: there is native taxonomy 'categories' and it belongs originally to 'posts'.
Then there is native WC taxonomy with the same name (but if you open it it's called 'product categories' to make the difference)
--> i can edit the 'posts' category and put it to 'products', but that's nonsense i guess, since it will result in two different 'category' taxonomies in WC products. So i'd leave that at 'posts'.
--> The other one, the native WC 'category' taxonomy, shows up in toolset dashboard at 'products' post type, but when clicked it give the error (see below) I shouldn't give this the 'products' connection since it belongs to products anyway, right?

There's also a 'product brands' taxonomy that's not toolset's and that gives the same error. So i can't edit them to be hierarchical....

The screenshot i can't post publicly, here's the url without domain:
/wp-admin/admin.php?page=wpcf-edit-tax&wpcf-tax=product_cat&ref=dashboard
and the error message is 'Wrong Taxonomy specified.'

Thanks a lot!

#553224
categories.png
code.png
select.png

Okay thank you for the explanation, I was rather confused as well. I understand a bit better now. You would like to change the Product Category input in a Product CRED form to use a select list. You can do this without editing the Product Category taxonomy - it's already hierarchical. You only need to modify the shortcode in your CRED form. See categories.png for an example of a hierarchical Product Category list. See code.png screenshot for an example in my CRED form editor. Then see select.png screenshot for the results in the CRED form.

I am using a default theme, so your select field may look different - but it should work like mine.

#553233

Hi Christian,
well that code was what i did earlier and didn't work for me! That's why i started this topic 🙂

But i found out what was the problem: in Toolset user guide on CRED, where they instruct how to use this little code, they used wrong accents! I copied it from there and put it in my cred code and it didnt work because of that. I noticed that now and changed to normal ' ' or " " and it works fine now. The user guide uses ´instead of ' and that's hardly notable.

Thanks!

#553247

Ok great, I'm glad you figured it out. Quotation marks are tricky, and they may need to change depending on where they are used. In general you will not ever use "backtick" marks like `, you will either use single quote ' or double quote ". If you run into questions feel free to open a ticket and we'll help you sort it out.