woocommerce_quantity_input()
Output the quantity input for add to cart forms.
No Hooks.
Returns
String.
Usage
woocommerce_quantity_input( $args, $product, $echo );
- $args(array)
- Args for the input.
Default:array() - $product(WC_Product|null)
- Product.
Default:null - $echo(true|false)
- Whether to return or echo|string.
Default:true
woocommerce_quantity_input() woocommerce quantity input code WC 10.6.2
function woocommerce_quantity_input( $args = array(), $product = null, $echo = true ) {
$product = is_null( $product ) ? $GLOBALS['product'] : $product;
$args = wc_get_quantity_input_args( $args, $product );
ob_start();
wc_get_template( 'global/quantity-input.php', $args );
if ( $echo ) {
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ob_get_clean();
} else {
return ob_get_clean();
}
}