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
/** | |
* LG :: Renders a notice and prevents checkout if the cart contains products in catering AND non-catering | |
*/ | |
function lg_wc_prevent_checkout_for_category() { | |
// If the cart is empty, then we bail out of this function | |
if (WC()->cart->is_empty()) { | |
return; | |
} | |
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
<?php | |
// add maximum quantity for cafe pickup items | |
add_filter( 'woocommerce_quantity_input_args', 'lg_woocommerce_quantity_input_args', 10, 2 ); | |
function lg_woocommerce_quantity_input_args( $args, $product ) { | |
if ( has_term( 'pastries', 'product_cat' ) || has_term( 'case', 'product_cat' ) || has_term( 'lunch', 'product_cat' ) ) { |
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
<?php | |
// add optional catering delivery fee to cart page IF catering product is in cart | |
add_action('woocommerce_cart_totals_after_shipping', 'lg_catering_delivery_info_at_cart'); | |
function lg_catering_delivery_info_at_cart() { | |
// set category check flag to be false until we find a product in that category | |
$cat_check = false; | |
// check each cart item for catering category |