Skip to content

Instantly share code, notes, and snippets.

@gedex
Created August 30, 2017 06:31
Show Gist options
  • Save gedex/0e444c1026604416ba8cad8ebaf4be6e to your computer and use it in GitHub Desktop.
Save gedex/0e444c1026604416ba8cad8ebaf4be6e to your computer and use it in GitHub Desktop.
Override rule cost for distance shipping when destination within 5miles of shop AND order total over $100
<?php
add_filter( 'woocommerce_distance_rate_shipping_rule_cost_distance_shipping', function( $rule_cost, $rule, $distance, $package ) {
$order_total = $package['contents_cost'];
if ( $order_total > 100 && $distance <= 5 ) {
$rule_cost = 0;
}
return $rule_cost;
}, 10, 4 );
@Sayar-tk
Copy link

Sayar-tk commented Dec 1, 2022

Hello. I'm interested in purchasing the WooCommerce Distance Rate Shipping plugin. I have a condition to make, would it be possible using to have this scenario: Delivery from restaurant: 1-3 miles & 20 pounds or above in basket = free delivery 1-3 miles & less than 20 pounds = 2.50 for delivery 1-3 miles & less than 12 pounds = no delivery

3.1-4.0 & 20 pounds or above in the basket = 1 pound delivery 3.1-4.0 & less than 20 pounds = 3.50 for delivery 3.1-4.0 & less than 12 pounds = no delivery

Is this doable in this plugin? If there needs to be a custom code, would you provide an example here? Thank you

Is it possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment