Hi community π
I have an ACF Field Group for WooCommerce Products that is used to show information on the product page. This ACF Field Group has the Show in REST API enabled.
However, when I access it through the API, I can’t see anything from ACF.
https://domain.com/wp-json/wc/v3/products/3644
Is there anything I’m doing wrong, is there any workaround or something I can do? The information there is very important.
Really thank you! π
I am having the same issue βΒ any ideas?
add to functions.php , I managed to achieve fields from ACF in the response
add_filter('woocommerce_rest_prepare_product_object', 'include_acf_fields_in_api_response', 10, 3);
function include_acf_fields_in_api_response($response, $post, $request) {
$data = $response->get_data();
$acf_fields = get_fields($response->data['id']);
$data['acf'] = $acf_fields;
$response->set_data($data);
return $response;
}