Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('wpali_distance_shipping_rate', 'wpali_add_base_price_to_rate', 10, 2);
- function wpali_add_base_price_to_rate($rate, $obj)
- {
- if (!empty($rate['meta_data']['value'])) {
- $meters = $rate['meta_data']['value'];
- $distance_in_km = $meters * 0.001;
- if($distance_in_km > 10 ){
- $rate['cost'] = $rate['cost'] + 29;
- }else{
- $rate['label'] = 'Fixed distance rate';
- $rate['cost'] = 29;
- }
- }
- return $rate;
- }
Advertisement
Add Comment
Please, Sign In to add comment