Automattic\WooCommerce\Internal\ProductFeed\Mapping
UcpProductMapper::build_categories
Build product categories from Store API terms.
Метод класса: UcpProductMapper{}
Хуков нет.
Возвращает
array.
Использование
// private - только в коде основоного (родительского) класса $result = $this->build_categories( $terms ): array;
- $terms(массив) (обязательный)
- Store API category objects.
Код UcpProductMapper::build_categories() UcpProductMapper::build categories WC 11.3.0
private function build_categories( array $terms ): array {
$categories = array();
foreach ( array_slice( $terms, 0, self::MAX_TERMS_PER_PRODUCT ) as $term ) {
$categories[] = array(
'id' => (string) $term['id'],
'name' => (string) $term['name'],
'value' => (string) $term['slug'],
);
}
return $categories;
}