0

we've added an additional field to our WooCommerce product categories and also added them to the WooCommerce REST API category response. It works like a charm!

Now, we wanna post values via WooCommerce REST API to this custom field, but it doesn't work. Do we need to extend the REST API for it? How can we do this?

Thanks in advance,

Daniel

function prep_category( $response, $item, $request ) {
    if( empty( $response->data ) )
        return $response;

    $term_id = $item->term_id;
    $wh_meta_title = get_term_meta($term_id, 'wh_meta_title', true);

    $response->data['OXID ID'] = esc_attr($wh_meta_title) ?     esc_attr($wh_meta_title) : '';

    return $response;
}
add_filter( "woocommerce_rest_prepare_product_cat", "prep_category", 10,     3 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.