Add a new term to a product attribute and set it in the product in Woocommerce
问题 My custom taxonomy (WooCommerce attribute) already exists and I am using the following to add a new term to the taxonomy and associate it with my WooCommerce product: wp_set_object_terms($product_id, array($omega_jahr), 'pa_years-of-construction'); When I use the following to call the 'pa_years_of_construction' for my product, I can see that the new terms have been saved: $v = array_values( wc_get_product_terms( $product->id, 'pa_years-of-construction', array( 'fields' => 'names' ) ) );