Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions

Utils::has_visible_quantity_input │ public static │ WC 1.0

Check if the HTML content has a visible quantity input.

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

Хуков нет.

Возвращает

bool. True if the HTML content has a visible input, false otherwise.

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

$result = Utils::has_visible_quantity_input( $html_content );
$html_content(строка) (обязательный)
The HTML content.

Код Utils::has_visible_quantity_input() WC 11.3.0

public static function has_visible_quantity_input( $html_content ) {
	$processor = new \WP_HTML_Tag_Processor( $html_content );

	while ( $processor->next_tag() ) {
		if (
			$processor->get_tag() === 'INPUT' &&
			$processor->has_class( 'qty' ) &&
			$processor->get_attribute( 'type' ) !== 'hidden'
		) {
			return true;
		}
	}
	return false;
}