Created
October 24, 2019 10:36
-
-
Save PluginHive/18fd1a330b1bf5cb1ab332ffc990886a to your computer and use it in GitHub Desktop.
Hide quantity in cart page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function hide_woocommerce_cart_item_quantity($product_quantity, $cart_item_key, $cart_item) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); | |
if($_product->is_sold_individually()) | |
{ | |
$product_type = $_product->get_type(); | |
if( $product_type == 'phive_booking' ) | |
{ | |
$product_quantity = sprintf( '%s <input type="hidden" name="cart[%s][qty]" value="1" />','', $cart_item_key ); | |
} | |
} | |
return $product_quantity; | |
} | |
add_filter( 'woocommerce_cart_item_quantity', 'hide_woocommerce_cart_item_quantity',10,3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment