11/26/2016 · add_action (‘woocommerce_update_options_shipping_’. $ this-> id, array ($ this, ‘process_admin_options’)) // Updating Shipping setting fields values add_filter ( ‘woocommerce_package_rates’ , array ( $ this , ‘wc_hide_shipping_when_is_available’ ) , 100 ) // this will hide other shipping methods if our shipping method is available, 10/28/2015 · This snippet will make the shipping methods cost free if the carts subtotal value is greater than or equal to $100. function wc_ninja_change_flat_rates_cost( $rates, $package ) { if ( isset( $rates[‘flat_rate:6’] ) ) { $cart_subtotal = WC()->cart->subtotal if ( $cart_subtotal >= 100 ) { $rates[‘flat_rate:6’]->cost = 0 } } return $rates } …
11/30/2018 · When adding a product to cart and the modifying product quantity in the cart (and clicking the Update Cart button) the woocommerce_package_rates filter is called each time When adding more items of the same product by click ing the Add to cart button on the product details page several times – the woocommerce_package_rates is not called each time, add_action ( ‘woocommerce_after_get_rates_for_package’, ‘action_function_name_46’, 10, 2 ) function action_function_name_46( $package, $shipping_method ){ // action… } $package(array) Package of cart items. $shipping_method(WC_Shipping_Method) Shipping method.
add_action ( ‘woocommerce_package_rate s’,’show_hide_shipping_methods’, 10, 2 ) function show_hide_shipping_methods( $rates, $package ) { // HERE Define your targeted shipping method ID $payment_method = ‘cod’ $chosen_payment_method = WC()->session->get(‘chosen_payment_method’) if( $payment_method == $chosen_payment_method ){.
4/3/2020 · add_action( ‘woocommerce _package_rates’,’show_hide_local_pickup_shipping_method s’, 10, 2 ) function show_hide_local_pickup_shipping_methods( $rates, $package ) { // HERE BELOW your product categories in the array $categories = array( ‘t-shirts’, ‘hat’ ) $term_found = false //.
2/28/2018 · Add a filter hook for woocommerce_package_rates and remove rates from $rates argument based on payment methods (using $woocommerce->session->chosen_payment_method) Use AJAX by triggering update_checkout ($(‘body’).trigger(‘update_checkout’)) to refresh the checkout form when changing payment.
11/19/2015 · add_action( woocommerce_package_rates , my_only_show_cheapest_shipping_rate, 10, 2 ) Just out of interest. Thanks again!, // Hide Local Delivery shipping method if cart less than $25 add_filter( ‘ woocommerce_package_rates ‘, ‘fivetwelve_hide_delivery_based_on_subtotal’, 10, 2 ) function fivetwelve_hide_delivery_based_on_subtotal( $rates, $package ) { // Get the current cart total $cart_subtotal = $package[‘contents_cost’] // Set the shipping class for ineligible products.
add_filter( ‘ woocommerce_package_rates ‘, ‘change_rates’, 10, 2 ) function change_rates( $rates, $packages ) { foreach ( $rates as $rate ) { $rate->label = Delivery $rate->cost = 40 }