It’s possible to adjust the shipping price set by Kikote based on the customer’s cart total with the help of some code. The below example is for the Cost by Distance Range feature.
PHP
function sl_cc_adjust_distance_range_shipping_cost($shipping_cost, $package, $wc_instance, $range_data){
$start_range = (int) $range_data['start_range'];
$end_range = (int) $range_data['end_range'];
$distance = $range_data['distance'];
$cart = $wc_instance->cart->get_subtotal();
if($start_range === 60 && $end_range === 100 && $cart > 2000){
return $distance * 1.5;
}
return $shipping_cost;
}
add_filter('kikote_distance_range_shipping_cost', 'sl_cc_adjust_distance_range_shipping_cost', 10, 4);
In the code above, if the customer is between the ranges of 60
and 100
, and their cart subtotal is more than $2000
, then the rate at which their shipping price will be calculated is $1.50
per unit distance.
It’s possible to do this for all Shipping workflows using the appropriate filter.
- Cost by Region –
kikote_region_shipping_cost
(params:$region_cost
,$customer_detected_region_costs
,$wc_instance
)
- Cost by Distance Standard –
kikote_distance_shipping_cost
(params:$shipping_cost
,$package
,$
,wc_instance
$distance_data
)
- Cost by Distance Range –
kikote_distance_range_shipping_cost
(params:$shipping_cost
,$package
,$wc_instance
,$distance_range_data
)
- Cost by Store Distance –
kikote_store_distance_shipping_cost
(params:$shipping_cost
,$package
,
,$wc_instance
$store_distance_data
)
- Cost by Store Location –
kikote_store_shipping_cost
(params:$store_shipping_cost
,$currently_selected_store_details
,$wc_instance
)