Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Capping shipping cost

Capping shipping cost

Locked

Views: 832

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
6 Sep 2010, 4:23 PM
#1
shazam_nz avatar

shazam_nz

New Zenner

Join Date:
Sep 2009
Posts:
8
Plugin Contributions:
0

Capping shipping cost

Hi,

I have a store that uses the Per Unit shipping module (can't change this) and i'm wanting to set a cap to the shipping cost.

Say someone orders 4 items with a shipping cost of $5 each, which totals $20. I want to be able to cap it so the max they'll be charged is $15. Is this possible at all?

Any help is appreciated! :)

6 Sep 2010, 6:05 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: Capping shipping cost

Edit the perweightunit.php shipping module and change the code:

  function quote($method = '') {
    global $order, $shipping_weight, $shipping_num_boxes;

    $total_weight_units = $shipping_weight;

// bof: maximum shipping $15.00
    $my_shipping_cost = MODULE_SHIPPING_PERWEIGHTUNIT_COST * ($total_weight_units * $shipping_num_boxes) +
                                                   (MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING);
    if ($my_shipping_cost > 15.00) {
      $my_shipping_cost = 15.00;
    }

    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
                          'methods' => array(array('id' => $this->code,
                                                   'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
                                                   'cost' => $my_shipping_cost ) ));

// eof: maximum shipping $15.00

    if ($this->tax_class > 0) {
      $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
    }

    if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

    return $this->quotes;
  }
6 Sep 2010, 6:41 PM
#3
shazam_nz avatar

shazam_nz

New Zenner

Join Date:
Sep 2009
Posts:
8
Plugin Contributions:
0

Re: Capping shipping cost

You are my new hero.

A thousand thank yous! :)

:clap:

6 Sep 2010, 6:54 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: Capping shipping cost

You are most welcome ... glad this worked well for you ... :smile: