Last active
April 24, 2020 16:42
-
-
Save andrasguseo/940d73f1c024ae232896dd3cd2ae23c0 to your computer and use it in GitHub Desktop.
Hide the quantity field on the WooCommerce 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
<?php | |
/* | |
* For the following plugins: | |
* The Events Calendar, Event Tickets, Event Tickets Plus, WooCommerce | |
* | |
* The function hides the quantity form field from the cart page | |
* so users cannot change the product / ticket quantity there. | |
* It shows the number as plain text. | |
* Note: it only allows you to put 1 of all products in the cart!!! | |
* Useful if you are collecting attendee information with Event Tickets Plus | |
* Add to your child theme's functions.php file | |
*/ | |
function wc_remove_quantity_field_from_cart( $return, $product ) { | |
if ( is_cart() ) return true; | |
} | |
add_filter( 'woocommerce_is_sold_individually', 'wc_remove_quantity_field_from_cart', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment