WC_Brands::duplicate_store_temporary_brands()
Temporarily tag a post with meta before it is saved in order to allow us to be able to use the meta when the product is saved to add the brands when an ID has been generated.
Метод класса: WC_Brands{}
Хуков нет.
Возвращает
WC_Product
. $original
Использование
$WC_Brands = new WC_Brands(); $WC_Brands->duplicate_store_temporary_brands( $duplicate, $original );
- $duplicate(WC_Product) (обязательный)
- -
- $original (обязательный)
- -
Код WC_Brands::duplicate_store_temporary_brands() WC Brands::duplicate store temporary brands WC 9.4.2
public function duplicate_store_temporary_brands( $duplicate, $original ) { $terms = get_the_terms( $original->get_id(), 'product_brand' ); if ( ! is_array( $terms ) ) { return; } $ids = array(); foreach ( $terms as $term ) { $ids[] = $term->term_id; } $duplicate->add_meta_data( 'duplicate_temp_brand_ids', $ids ); }