Automattic\WooCommerce\Blocks\BlockTypes\AddToCartWithOptions
GroupedProductItemSelector::remove_quantity_label
Removes the label from quantity input HTML.
Method of the class: GroupedProductItemSelector{}
No Hooks.
Returns
String. The quantity input HTML without the label.
Usage
// private - for code of main (parent) class only $result = $this->remove_quantity_label( $quantity_html );
- $quantity_html(string) (required)
- The quantity input HTML.
GroupedProductItemSelector::remove_quantity_label() GroupedProductItemSelector::remove quantity label code WC 10.8.1
private function remove_quantity_label( $quantity_html ) {
// Remove the label and aria-label from the quantity input.
$quantity_html = preg_replace( '/<label[^>]*>.*?<\/label>/s', '', $quantity_html );
return preg_replace( '/\s*aria-label="[^"]*"/', '', $quantity_html );
}