WC_Brands::duplicate_add_product_brand_terms()
After product was added check if there are temporary brands and add them officially and remove the temporary brands.
Метод класса: WC_Brands{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$WC_Brands = new WC_Brands(); $WC_Brands->duplicate_add_product_brand_terms( $product_id );
- $product_id(int) (обязательный)
- -
Список изменений
С версии 9.4.0 | Введена. |
Код WC_Brands::duplicate_add_product_brand_terms() WC Brands::duplicate add product brand terms WC 9.4.2
public function duplicate_add_product_brand_terms( $product_id ) { $product = wc_get_product( $product_id ); // Bail if product isn't found. if ( ! $product instanceof WC_Product ) { return; } $term_ids = $product->get_meta( 'duplicate_temp_brand_ids' ); if ( empty( $term_ids ) ) { return; } $term_taxonomy_ids = wp_set_object_terms( $product_id, $term_ids, 'product_brand' ); $product->delete_meta_data( 'duplicate_temp_brand_ids' ); $product->save(); }