i need get the brand name of product , i have this code
$product = wc_get_product(); $type = $product->get_type(); $name = (string)$product->get_name(); $id = (int)$product->get_id(); $sku = (int)$product->get_sku(); $precio = (int)$product->get_price(); $brand_name = $product->get_brand(); ---> ???
i get this attributes but i don’t know how catch the brand name, is there another way ?
Thanks!
Advertisement
Answer
Use get_the_terms
get_the_terms($product->get_id(),'pa_brand')