I have woo variation swatches plugin on my website and I want to use woocommerce and wordpress in a headless project. my problem is when I want to fetch attribute terms via
/wp-json/wc/v3/products/attributes/COLOR_ATTRIBUTE_ID/terms
the returned result doesn’t include the color code field. I know the color code is stored in termmeta table with product_attribute_color key. is there any way to add this meta as a field to the attributes result in rest API?
2
Answers
I posted the correct code for my own question, Lowin Ko Ko's answers helped me to find the solution but because his code is psuedo code I posted my code here.
You can extend with
woocommerce_rest_prepare_(taxonomy)
hooks like this –