Reputation: 3288
I am using Drupal 7 with ubercart shipping. My client want the cost of shipping to be ups ground quote unless it is >=$50. Then he wants to charge a flat $50.
I created a flat rate that cost $50 and a ups ground quote.
I don't see a condition that uses the shipping quote to determine shipping method. Any ideas?
Upvotes: 0
Views: 1510
Reputation: 3288
Got this figured out. Not pretty but it works. Just go to the ups option and add a condition with php evaluation. note that you must have two payment methods available for conditions to work. Paste this code.
$method = array (
'id' => 'ups',
'module' => 'uc_ups',
'title' => 'UPS',
'operations' => array (
'configure' => array (
'title' => 'configure',
'href' => 'admin/store/settings/quotes/settings/ups',
),
),
'quote' => array (
'type' => 'small_package',
'callback' => 'uc_ups_quote',
'accessorials' => array (
'03' => 'UPS Ground',
),
),
'ship' => array (
'type' => 'small_package',
'callback' => 'uc_ups_fulfill_order',
'file' => 'uc_ups.ship.inc',
'pkg_types' => array (
'02' => 'Customer Supplied Package',
'01' => 'UPS Letter',
'03' => 'Tube',
'04' => 'PAK',
21 => 'UPS Express Box',
24 => 'UPS 25KG Box',
25 => 'UPS 10KG Box',
30 => 'Pallet',
'2a' => 'Small Express Box',
'2b' => 'Medium Express Box',
'2c' => 'Large Express Box',
),
),
'cancel' => 'uc_ups_void_shipment',
'enabled' => 1,
'weight' => '0',
);
$details->postal_code = $order->delivery_postal_code;
$details->zone = $order->delivery_zone;
$details->country = $order->delivery_country;
$quote = uc_ups_quote($order->products, $details , $method);
return ($quote['03']['rate'] < 50);
The method can be adjusted for other types of shipping this condition applies to only ups ground. You could modify this to automatically choose the least expensive method between ups/fedex or something like that too.
Anyway. Hope this helps someone else out there.
Upvotes: 1