How can I implement a shipping cost of a flat rate plus a cost per item? For example, if I want to charge $5.95 plus $1 per item, how can I implement that? Is there a way to setup the modules already available, or is there a special download/programming needed?
1. EDIT: catalog/model/shipping/item.php
2. FIND:
3. REPLACE WITH:
4. FIND:
5. REPLACE WITH:
2. FIND:
Code: Select all
'cost' => $this->config->get('item_cost') * $this->cart->countProducts(),
Code: Select all
'cost' => 5.95 + $this->config->get('item_cost') * $this->cart->countProducts(),
Code: Select all
'text' => $this->currency->format($this->tax->calculate($this->config->get('item_cost') * $this->cart->countProducts(), $this->config->get('item_tax_class_id'), $this->config->get('config_tax')))
Code: Select all
'text' => $this->currency->format($this->tax->calculate(5.95 + $this->config->get('item_cost') * $this->cart->countProducts(), $this->config->get('item_tax_class_id'), $this->config->get('config_tax')))
This post was helpful to me, though I ended up going about it a little differently. Here's how I set a flat rate shipping cost for one item, with $1 added for each subsequent item:
1. Ensure Flat Rate Shipping is Enabled in 'Extensions > Shipping > Flat Rate'
2. Set flat rate shipping to $1 LESS than what you want your flat rate to be
(example: if you want a 5.95 flat rate, set the value to 4.95)
2. Open 'catalog > model > shipping > flat.php'
FIND:
REPLACE WITH:
FIND:
REPLACE WITH:
What This Does:
It takes your flat shipping rate value and adds the number of total items in your cart. So for example, if you want to charge a flat $5.95 plus $1 per each additional item, you set 'Extensions > Shipping > Flat Rate' to $4.95 (which is $1 less than your actual flat rate.
If a shopper has 1 item in their cart at checkout, it will calculate $4.95 (Flat Shipping Rate ) PLUS 1 (which is the quantity of items in cart) = $5.95 (correct shipping total for one item)
If a shopper has 2 items in their cart at checkout, it will calculate $4.95 + 2 (number of items in cart) = $6.95 (correct shipping total for two items).
The above code only works if you're specifically only charging $1 more for each additional item shipped. It wouldn't work if you wanted to charge, say, $2.50 for each additional item.
1. Ensure Flat Rate Shipping is Enabled in 'Extensions > Shipping > Flat Rate'
2. Set flat rate shipping to $1 LESS than what you want your flat rate to be
(example: if you want a 5.95 flat rate, set the value to 4.95)
2. Open 'catalog > model > shipping > flat.php'
FIND:
Code: Select all
'cost' => $this->config->get('flat_cost'),
Code: Select all
'cost' => $this->config->get('flat_cost') + $this->cart->countProducts(),
Code: Select all
'text' => $this->currency->format($this->tax->calculate($this->config->get('flat_cost'), $this->config->get('flat_tax_class_id'), $this->config->get('config_tax')))
Code: Select all
'text' => $this->currency->format($this->tax->calculate($this->config->get('flat_cost') + $this->cart->countProducts(), $this->config->get('flat_tax_class_id'), $this->config->get('config_tax')))
It takes your flat shipping rate value and adds the number of total items in your cart. So for example, if you want to charge a flat $5.95 plus $1 per each additional item, you set 'Extensions > Shipping > Flat Rate' to $4.95 (which is $1 less than your actual flat rate.
If a shopper has 1 item in their cart at checkout, it will calculate $4.95 (Flat Shipping Rate ) PLUS 1 (which is the quantity of items in cart) = $5.95 (correct shipping total for one item)
If a shopper has 2 items in their cart at checkout, it will calculate $4.95 + 2 (number of items in cart) = $6.95 (correct shipping total for two items).
The above code only works if you're specifically only charging $1 more for each additional item shipped. It wouldn't work if you wanted to charge, say, $2.50 for each additional item.
Is there a way to do this with the weight based shipping? I need both shipping costs and additional item costs to be different for my different zones.
Who is online
Users browsing this forum: No registered users and 12 guests