Answer the question
In order to leave comments, you need to log in
How to update ACF fields for WooCommerce product category when category is updated?
Hello!
I just can't understand - is there a simple way to update the meta fields for the taxonomy term (as in my woocommerce product category example) ?
I try to do so
function product_cat_save_taxonomy_description( $term_id ) {
$term_descriptions = get_field($sub_domain.'_subdomain_description', 'product_cat_'.$term_id);
if (!$term_descriptions) {
$meta_value = 'hello';
update_field($sub_domain.'_subdomain_description', $meta_value, 'product_cat_'.$term_id); }
add_action( 'create_product_cat', 'product_cat_save_taxonomy_description', 10, 2 );
add_action( 'edited_product_cat', 'product_cat_save_taxonomy_description', 10, 2 );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question