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 | |
// Replace 'shippingClass' with the specific class upon which you wish to make the free shipping option available | |
add_filter( 'woocommerce_shipping_free_shipping_is_available', 'free_shipping_based_on_cart_shipping_class' ); | |
function free_shipping_based_on_cart_shipping_class( $is_available ) { | |
$cart_items = WC()->cart->get_cart(); | |
$found = false; | |
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 | |
// Replace 'shipping-class' with the specific shipping class you want to force the local pick up upon | |
// To make it more readable, replace $shippingClass with your class name, eg : $hugeProducts | |
function my_hide_shipping_when_local_is_available( $rates ) { | |
$cart_items = WC()->cart->get_cart(); | |
$shippingClass = false; | |
foreach ( $cart_items as $cart_item ) { |
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
add_filter( 'pdf_template_order_totals' , 'coupon_pdf_template_order_totals', 10, 2 ); | |
function coupon_pdf_template_order_totals( $output, $order_id ) { | |
global $woocommerce; | |
if ( !$order_id ) { | |
return; | |
} | |
$order = new WC_Order( $order_id ); |