Archived topic
Remove quantity in Cart WooCommerce
3 replies · Started by Dan on December 25, 2022
Hi there,
I need some help, please. How can I remove quantity in Cart and Checkout (Tab) of WooCommerce?
Hi Dan,
For clarity, can you provide a screenshot of the specific "Quantity" block you which to remove?
Uploading Screenshots: https://docs.generatepress.com/article/using-the-premium-support-forum/#uploading-screenshots
Hi Fernando,
I find what's I looking for:
------------------------------
add_filter( 'woocommerce_cart_item_quantity', 'wc_cart_item_quantity', 10, 3 );
function wc_cart_item_quantity( $product_quantity, $cart_item_key, $cart_item ){
if( is_cart() ){
$product_quantity = sprintf( '%2$s <input type="hidden" name="cart[%1$s][qty]" value="%2$s" />', $cart_item_key, $cart_item['quantity'] );
}
return $product_quantity;
}
------------------------------
Again, thank you!
I see. Thank you for sharing this! You're welcome, Dan!
