Automattic\WooCommerce\StoreApi\Schemas\V1

ProductSchema::prepare_product_attribute_value()protectedWC 1.0

Prepare an attribute term for the response.

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

Хуков нет.

Возвращает

Объект.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->prepare_product_attribute_value( $name, $id, $slug );
$name(строка) (обязательный)
Attribute term name.
$id(int)
Attribute term ID.
$slug(строка)
Attribute term slug.
По умолчанию: ''

Код ProductSchema::prepare_product_attribute_value() WC 8.7.0

protected function prepare_product_attribute_value( $name, $id = 0, $slug = '' ) {
	return (object) [
		'id'   => (int) $id,
		'name' => $name,
		'slug' => $slug ? $slug : $name,
	];
}