Custom functions

Hide checkout live rates if country = "Bulgaria"

if ( ! function_exists( 'iben_ups_skip_country_front_rates' ) ) {
    
    function iben_ups_skip_country_front_rates($default, $args){
        
        if (isset($args['destination']['country']) && $args['destination']['country'] == 'BG') return true;

        return $default;
    }

add_filter('iben_ups_filter_liverate_checkout_disable_request_rate', 'iben_ups_skip_country_front_rates', 10, 2);
}

Change default account id for frontend live rates

if ( ! function_exists( 'iben_ups_change_default_account_id_front_rates' ) ) {
    function iben_ups_change_default_account_id_front_rates($account_id){
        // account ID
    	return 20;
    }
    
add_filter('iben_ups_filter_live_rates_default_account', 'iben_ups_change_default_account_id_front_rates');
}

Change default weight to 0.5 for all products if didn't set or equal to zero

Hide UPS Standard ( ID:11 ) if country is France and total weight > 10kg

Hide shipment creation box for specific countries

Override final UPS rate price. Add 24% percent

Override Fallback price

If country is Bulgaria and total weight <= 1 price = 15 else price = 50 else if other country return default fallback price

Change UPS description with order customer notes

Add Order ID in the description field

This may not work for USA domestic shipments. Alternatively, you can use the next function

Change the default reference1 of the label with the order ID

Change the default reference1 of the label with product names

Change order First name & Last name

By default, plugins fill first the Last name and then the First name

With the following function, you can revert the sorting

Last updated