Automattic\WooCommerce\Internal\ProductAttributes

VisualAttributeTermMeta::save_term_visual_by_type │ public static │ WC 10.9.0

Save visual attribute term meta using the selected visual type.

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

Хуков нет.

Возвращает

void. Ничего (null).

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

$result = VisualAttributeTermMeta::save_term_visual_by_type( $term_id, $type, $color, $image_id ): void;
$term_id(int) (обязательный)
Term ID.
$type(строка) (обязательный)
Selected visual type.
$color(строка)
Hex color value.
По умолчанию: ''
$image_id(int)
Attachment ID for the term image.

Список изменений

С версии 10.9.0 Введена.

Код VisualAttributeTermMeta::save_term_visual_by_type() WC 11.2.2

public static function save_term_visual_by_type( int $term_id, string $type, string $color = '', int $image_id = 0 ): void {
	if ( self::TYPE_IMAGE === $type ) {
		self::save_term_visual( $term_id, '', $image_id );
		return;
	}

	self::save_term_visual( $term_id, $color, 0 );
}