Last active
September 7, 2023 08:58
-
-
Save AnanthFlycart/b79649dca0f6466fb8425d422d6b6d18 to your computer and use it in GitHub Desktop.
CUW: Remove offer quantity when product is digital
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('cuw_offer_template_product_quantity', function ($html, $offer) { | |
| if (!empty($offer['id']) && !empty($offer['product']['id']) && function_exists('wc_get_product')) { | |
| $product = wc_get_product($offer['product']['id']); | |
| if (!empty($product) && ($product->is_virtual() || $product->is_downloadable())) { | |
| $html = '<input type="hidden" name="quantity" value="1"/>'; | |
| } | |
| } | |
| return $html; | |
| }, 100, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment