Récupérer la catégorie de produit 'NAME' par ID de catégorie de produit - WooCommerce?
1 réponses
- votes
-
- 2014-06-18
Utilisez
get_term_by
:$id = 42; if( $term = get_term_by( 'id', $id, 'product_cat' ) ){ echo $term->name; }
Use
get_term_by
:$id = 42; if( $term = get_term_by( 'id', $id, 'product_cat' ) ){ echo $term->name; }
-
Atrèsbien fonctionné!Merci. Celane fonctionnaitpas avant,maisj'ai changé 'product_category'en 'product_cat'et cela afonctionnéWorked great! Thanks. It wasn't working before, but I changed 'product_category' to 'product_cat' and it worked
- 1
- 2014-06-18
- user3137901
-
oh désolé,j'ai oublié lenom detaxonomie utilisépar woocommerce.oh sorry, forgot the taxonomy name woocommerce uses.
- 0
- 2014-06-18
- Milo
Puis-je récupérer lenom de la catégorie deproduits woocommercepar ID?
Pas de vignette,pas d'URL,pas de sous-catégories,juste unnom de catégoriebrut.