Answers for "woocommerce get all category id of a product"

PHP
6

woocommerce get product id

global $product;
$product->get_id();
Posted by: Guest on July-03-2020
0

woocommerce get product categories

$terms = get_the_terms( $product_id, 'product_cat' );
foreach ($terms as $term) {
    $product_cat_id[] = $term->term_id;
}
Posted by: Guest on July-23-2021

Code answers related to "woocommerce get all category id of a product"

Browse Popular Code Answers by Language