[ic] UPSE Online, special handling charge, adder

Daniel Browning db at endpoint.com
Wed Nov 19 21:08:58 UTC 2008


On Wednesday 19 November 2008 12:33:48 pm Steve Graham wrote:
> Hello,
>
> We have a few items in our inventory that require a large/irregular box,
> and causes a surcharge from UPS due to box size.
>
> I am considering adding a field to the products file to flag these items,
> and if there is at least one item on an order that requires the special
> box size then add on a flat surcharge to the shipping fee.  I don't want
> to add the surcharge per item, just 1 time if any flagged items are on
> the order.
>
> Has anyone done something like this, any suggestions?
> I was thinking  the adder in shipping.asc might work, but not sure.

Steve,

An adder in shipping.asc is a good idea, but would require modification to 
every shipping method. You could build it into the handling system, and 
that would only have to be defined one time, but that's not something I 
would find desirable.

The way I've done this before is to use SpecialSub shipping_callout. This 
feature allows you to build a GlobalSub that takes the existing shipping 
amount, checks the cart for applicable items, then adds the fee. Whatever 
customizations you need will automatically apply to every shipping method. 
For example (untested):

# A perly true value in 'products.oversized' field adds UPS fee.
AutoModifier oversized

Variable UPS_OVERSIZED_FEE 25.00

Sub custom_shipping <<EOS
sub {
    my ($final, $mode, $opt, $o) = @_;
    
    $final += $Variable->{UPS_OVERSIZED_FEE}
        if grep {$_->{oversized}} @$Items;

    return $final;
}
EOS

SpecialSub shipping_callout custom_shipping

--
Daniel Browning
End Point Corporation
http://www.endpoint.com/



More information about the interchange-users mailing list