News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Shipping fee based on category

Started by brockp, April 13, 2013, 21:23:21 PM

Previous topic - Next topic

brockp

We have a need to ship food products in the US.  During part of the year we need product of a type to be packed in a cooler and dry ice when shipped to specific states. (assume US only shipping).

Looking at the rules, is there a way to add a rule to add to a shipping fee based on state and product category?
Also we need a cooler for every X pounds of that type of product. Coolers and ice are not cheap, adds about $10USD to the order.

I'm looking to make something like the following pseudo code:

if($FreshWeight > 0 AND "ship to state is in list"){
   $numberCoolers = ceil($FreshWeight/$poundsPerCooler)
   $addiShipFee = $numberCoolers*10.00
}

I assume $freshWeight could be taken from all products in category $fresh. I would also like to not show this category to users, just use it as a feature of the product to calculate if they need the extra shipping calculation.

Is there a better way to handle this?

PRO

http://extensions.virtuemart.net/shipments


Here is a little function I was working on for my shipping plugin


// working on this product ID method working
    private function _ids($cart, $method) {
   foreach ($cart->products as $product) {
       if ($product->virtuemart_product_id ==194){$result=-50;}
   }
   return $result;
    }


if you notice   $product->virtuemart_product_id ==194

You could easily do

$product->virtuemart_category_id ==194