Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    920
    Plugin Contributions
    1

    Default Hide shipping method if order is over a certain weight?

    Is there a way to hide a shipping method of an order is over a certain weight? I am shipping some small items and if they are under a certain weight they can go lettermail which is quite cheap. I am using the table rate for the lettermail since there are a few weight/price levels. The problem is that if their order goes over the max lettermail rate, my alternate shipping option shows, but lettermail is still showing as well, but with a cost of $0.00! Is there some code I can add into my table.php file to hide it if the order is over a certain weight?

    I tried this but no luck:
    $this->code = 'table';
    $this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_TABLE_TAX_BASIS;
    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
    $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);}

    if ($shipping_weight > "0.5") {
    $this->enabled = false;}
    The bolded part is what I added. I've tried a few variations of it too, but I know I must be missing something significant. There are no errors during checkout with that code added, but it doesn't change anything either, the lettermail cost still shows as $0.00.

    If anyone can point me to what I'm missing in the code I would really appreciate it!

    TIA!
    Danielle

  2. #2
    Join Date
    Jul 2005
    Posts
    114
    Plugin Contributions
    0

    Default Re: Hide shipping method if order is over a certain weight?

    I'm on the same problem, and still I didn't find the answer.

    Dr.Byte kindly gave me this piece of advice :

    global $shipping_weight;
    if ($shipping_weight >= 2) {
    $this->enabled = false;
    }

    Hope it helps

 

 

Similar Threads

  1. Info/Orders at a Glance Admin Contribution for 1.2.7 and 1.3.0.
    By Reesy in forum All Other Contributions/Addons
    Replies: 203
    Last Post: 17 Feb 2012, 04:15 PM
  2. Average Weight Per Unit Shipping Support Thread
    By numinix in forum Addon Shipping Modules
    Replies: 3
    Last Post: 12 Mar 2009, 02:38 PM
  3. Free shipping on order less than free ship price
    By wynnesome in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 8 May 2007, 09:53 PM
  4. Weight based shipping
    By Graffxman in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 2 Jan 2007, 01:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •