WC_Product_Variation_Data_Store_CPT::update_terms( WC_Product $product, bool $force = false )
For all stored terms in all taxonomies, save them to the DB.
Description Description
Parameters Parameters
- $product
-
(Required) Product object.
- $force
-
(Optional) Force update. Used during create.
Default value: false
Source Source
File: includes/data-stores/class-wc-product-variation-data-store-cpt.php
protected function update_terms( &$product, $force = false ) {
$changes = $product->get_changes();
if ( $force || array_key_exists( 'shipping_class_id', $changes ) ) {
wp_set_post_terms( $product->get_id(), array( $product->get_shipping_class_id( 'edit' ) ), 'product_shipping_class', false );
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |