Created
July 7, 2024 14:36
-
-
Save shameemreza/75ed2e20223c3c5ce2e3d781eafc3c1a to your computer and use it in GitHub Desktop.
Disable quantity input on product pages in WooCommerce
This file contains hidden or 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
add_filter( 'woocommerce_quantity_input_min', 'hide_woocommerce_quantity_input', 10, 2 ); | |
add_filter( 'woocommerce_quantity_input_max', 'hide_woocommerce_quantity_input', 10, 2 ); | |
function hide_woocommerce_quantity_input( $quantity, $product ) { | |
// only on the product page | |
if ( ! is_product() ) { | |
return $quantity; | |
} | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment