Last active
September 26, 2015 17:22
-
-
Save spiderflystudios/19e3463eeb97213c2cdb to your computer and use it in GitHub Desktop.
Revisions
-
spiderflystudios revised this gist
Sep 26, 2015 . No changes.There are no files selected for viewing
-
spiderflystudios revised this gist
Sep 26, 2015 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
spiderflystudios created this gist
Sep 26, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ // display max quantity allowed if set on single product page add_action('woocommerce_single_product_summary', 'maxquantityallowed', 30); function maxquantityallowed() { if(get_post_meta( get_the_ID(), 'maximum_allowed_quantity', true ) ){ echo 'Maximum quantity allowed for this product is <strong>'. get_post_meta( get_the_ID(), 'maximum_allowed_quantity', true ) .'</strong>. Request a custom quote for bulk orders.'; } } 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // hide quantity box if max quantity is set to one add_action('wp_head','hide_quantity_counter'); function hide_quantity_counter() { global $product; $product = new WC_Product( get_the_ID() ); $productcount = get_post_meta( get_the_ID(), 'maximum_allowed_quantity', true ); // adjust for different product types if (($product->is_type( 'bundle' )) || $productcount == 1) { echo '<style> div.bundled_item_cart_content div.bundle_button div.quantity {display:none!important;} </style>'; } if (($product->is_type( 'simple' )) || $productcount == 1) { echo '<style> div.quantity {display:none!important;} div.bundled_product div.quantity {display:inherit!important;} </style>'; } if (($product->is_type( 'variable' )) || $productcount == 1) { echo '<style> div.variations_button div.quantity {display:none!important;} div.bundled_product div.variations_button div.quantity {display:inherit!important;} </style>'; } }