I am trying to get custom added attributes and its terms of a variable product using woocommerce rest API here is the value that i want from woocommerce rest api. But i dont find any woocommerce rest api documentation of getting custom attribute and attribute terms of variable product. thanks in advance
Asked
Active
Viewed 91 times
1 Answers
0
You can try the following
1.get_post_meta
to get the product attributes
$attr = get_post_meta( 123, '_product_attributes' ); // replace 123 with the actual product id
print_r( $attr );
2.Or you can create a product object and then using the get_attributes
method
$p = new WC_Product( 123 ); // // replace 123 with the actual product id
print_r( $p->get_attributes() );
![](../../users/profiles/8403037.webp)
felix manzanas
- 117
- 4