Skip to content

Instantly share code, notes, and snippets.

@PluginHive
Created October 17, 2019 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PluginHive/ca70fdf45b307e92f3b2351aa17aedb8 to your computer and use it in GitHub Desktop.
Save PluginHive/ca70fdf45b307e92f3b2351aa17aedb8 to your computer and use it in GitHub Desktop.
Hide quantity in checkout page for bookable products
//snippet to hide quantity in checkout page for bookable products
add_filter( 'woocommerce_checkout_cart_item_quantity', 'woocommerce_checkout_cart_item_quantity_ph',10,3 );
function woocommerce_checkout_cart_item_quantity_ph($quantity_html,$cart_item,$key ) {
if(!empty($cart_item) && isset($cart_item['product_id']) && !empty($cart_item['product_id']))
{
$product=wc_get_product($cart_item['product_id']);
if(!empty($product) && !empty($product->get_type()) && $product->get_type()=='phive_booking')
{
return "";
}
}
return $quantity_html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment