WC_Product_Variation_Data_Store_CPT::update_terms()protectedWC 3.0.0

For all stored terms in all taxonomies, save them to the DB.

Метод класса: WC_Product_Variation_Data_Store_CPT{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->update_terms( $product, $force );
$product(WC_Product) (обязательный) (передается по ссылке — &)
Product object.
$force(true|false)
Force update. Used during create.
По умолчанию: false

Список изменений

С версии 3.0.0 Введена.

Код WC_Product_Variation_Data_Store_CPT::update_terms() WC 8.6.1

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 );
	}
}