Answers for "get product category by product id woocommerce"

4

get product price woocommerce of specific id

$product = wc_get_product( $post_id );

$product->get_regular_price();
$product->get_sale_price();
$product->get_price();
Posted by: Guest on February-11-2021
1

is product category woocommerce

if( is_product_category() ) {
	// yay, we are on a product category page!
} else {
 
}
Posted by: Guest on October-30-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
0

is product category woocommerce

if( has_term( 4, 'product_cat' ) ) {
	// do something if current product in the loop is in product category with ID 4
}
Posted by: Guest on February-26-2021

Code answers related to "get product category by product id woocommerce"

Browse Popular Code Answers by Language