Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Use flat rate up to a certain weight, then use USPS

Use flat rate up to a certain weight, then use USPS

Views: 833

Results 1 to 3 of 3
26 Jun 2012, 1:08 AM
#1
whitewolf avatar

whitewolf

New Zenner

Join Date:
Jun 2009
Posts:
17
Plugin Contributions:
0

Use flat rate up to a certain weight, then use USPS

Hello,

Right now, I am using flat rate shipping, but I would like to modify my shipping rules as follows (all products in database have the correct weight attached to them, and USPS module is setup and working):

If the shipping weight is less than 20 lbs, then use flat rate
else, if weight 20 lbs or greater, calculate shipping using USPS module

In doing my research, I found an old thread that detailed how to disable flat rate above a certain weight:
http://www.zen-cart.com/showthread.php?114986-unable-to-disable-flat-rate-with-maximum-weight&highlight=flat+rate+weight

so, I guess my questions are 1) is this method of disabling flat rate shipping still usable? and 2) once flat rate shipping is disabled, will Zen Cart default to USPS shipping (I also have in-store pickup enabled in the shipping module section)?

thanks!

26 Jun 2012, 2:09 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Use flat rate up to a certain weight, then use USPS

Disabling flat rate will still work
Might take a bit of code to not show USPS until a certain weight is acheived

26 Jun 2012, 2:21 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Use flat rate up to a certain weight, then use USPS

Just use something similar in the usps.php ...

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
    }

// bof: If the shipping weight is less than 20lb disable the module
if (!IS_ADMIN_FLAG) {
  global $cart;
  if ($_SESSION['cart']->show_weight() < 20) {
    $this->enabled = false;
  }
}
// eof: If the shipping weight is less than 20lb disable the module