Skip to content

Instantly share code, notes, and snippets.

@dsignr
Created April 24, 2018 17:10
Show Gist options
  • Save dsignr/b49d6ea996263712a5f85e1304a86275 to your computer and use it in GitHub Desktop.
Save dsignr/b49d6ea996263712a5f85e1304a86275 to your computer and use it in GitHub Desktop.
<?php
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else {
$product_quantity = woocommerce_quantity_input( array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0',
'product_name' => $_product->get_name(),
), $_product, false );
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment