Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Renderer\Blocks

Product_Collection::build_attribute_query │ private │ WC 1.0

Build attribute query from woocommerceAttributes block attributes.

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

Хуков нет.

Возвращает

array.

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

// private - только в коде основоного (родительского) класса
$result = $this->build_attribute_query( $attributes ): array;
$attributes(массив) (обязательный)
Attribute filters from block attributes.

Код Product_Collection::build_attribute_query() WC 11.2.2

private function build_attribute_query( array $attributes ): array {
	$attribute_queries = array();

	foreach ( $attributes as $attribute ) {
		if ( ! empty( $attribute['taxonomy'] ) && ! empty( $attribute['termId'] ) ) {
			$attribute_queries[] = array(
				'taxonomy' => $attribute['taxonomy'],
				'field'    => 'term_id',
				'terms'    => array( (int) $attribute['termId'] ),
			);
		}
	}

	return $attribute_queries;
}