Post by belowcost » Tue Aug 04, 2020 2:29 am

Is there a way to add either a percentage increase, OR a service fee to USPS shipping rates displayed in the cart?

OC 3.0 USPS shipping API setup how to add a percentage or service fee

So if the rate for a shipment is returned by USPS of $10.00 by the API, have it increased by 5% so the rate displayed and charged to the customer would be $10.50

Or have a preset $5.00 added to any rate?

Thank you

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by Cue4cheap » Tue Aug 04, 2020 3:38 am

belowcost wrote:
Tue Aug 04, 2020 2:29 am
Is there a way to add either a percentage increase, OR a service fee to USPS shipping rates displayed in the cart?

OC 3.0 USPS shipping API setup how to add a percentage or service fee

So if the rate for a shipment is returned by USPS of $10.00 by the API, have it increased by 5% so the rate displayed and charged to the customer would be $10.50

Or have a preset $5.00 added to any rate?

Thank you
Look at the USPS extension and see if there is a way to capture what is being returned and add to it. I am away from a place that I can look at the code but it could be pretty simple.

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by belowcost » Tue Aug 04, 2020 7:03 am

i see some lines in the USPS extension but not sure what to do?
is this the section?

Code: Select all

		if (isset($this->request->post['shipping_usps_domestic_00'])) {
			$data['shipping_usps_domestic_00'] = $this->request->post['shipping_usps_domestic_00'];
		} else {
			$data['shipping_usps_domestic_00'] = $this->config->get('shipping_usps_domestic_00');
		}

		if (isset($this->request->post['shipping_usps_domestic_01'])) {
			$data['shipping_usps_domestic_01'] = $this->request->post['shipping_usps_domestic_01'];
		} else {
			$data['shipping_usps_domestic_01'] = $this->config->get('shipping_usps_domestic_01');
		}

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by letxobnav » Tue Aug 04, 2020 8:42 am

catalog/model/extension/shipping/usps.php
this is where the individual usps quotes are build:

Code: Select all

									$quote_data[$id] = array(
										'code'         => 'usps.' . $id,
										'title'        => $title,
										'cost'         => $this->currency->convert($cost, 'USD', $this->config->get('config_currency')),
										'tax_class_id' => $this->config->get('shipping_usps_tax_class_id'),
										'text'         => $this->currency->format($this->tax->calculate($this->currency->convert($cost, 'USD', $this->session->data['currency']), $this->config->get('shipping_usps_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'], 1.0000000)
									);

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Cue4cheap » Tue Aug 04, 2020 9:02 am

Thank you letxobnav for posting the code as I couldn't get to it from where I was....

So belowcost
Something like changing $cost to ($cost*1.1) would give you a 10% mark-up.

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by Johnathan » Tue Aug 04, 2020 8:17 pm

Just to note, Hidden Shipping Adjustments is designed to do this. It can increase weight before quotes are requested, or costs after they are returned, by a flat amount or a percentage. I totally get if you want to code this yourself, but I thought I'd mention it as an option.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by belowcost » Tue Aug 04, 2020 9:48 pm

I dont see $COST as a variable anywhere in the file.

The file I am looking at usps.php is located here /admin/controller/extension/shipping

please check your P.M. I sent. Thx again

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by Cue4cheap » Tue Aug 04, 2020 10:15 pm

belowcost wrote:
Tue Aug 04, 2020 9:48 pm
I dont see $COST as a variable anywhere in the file.

The file I am looking at usps.php is located here /admin/controller/extension/shipping

please check your P.M. I sent. Thx again
How about looking above at this post:

by letxobnav » Mon Aug 03, 2020 6:42 pm

catalog/model/extension/shipping/usps.php
this is where the individual usps quotes are build:

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by belowcost » Wed Aug 05, 2020 10:01 pm

Hi

I looked at the post and noticed where it mentioned $COST but couldnt determine where to insert the code.

I P.M.'d that page's code to you in hopes you could help. THX

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by Cue4cheap » Thu Aug 06, 2020 7:17 am

The file is usps.php under this path: catalog/model/extension/shipping/

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am

Post by belowcost » Thu Aug 06, 2020 12:09 pm

that is the same file and path you sent me a couple days ago

that is what I p.m.'d you with

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by belowcost » Thu Aug 06, 2020 12:09 pm

I looked at the post and noticed where it mentioned $COST but couldnt determine where to insert the code.

I P.M.'d that page's code to you in hopes you could help. THX

Active Member

Posts

Joined
Mon Sep 26, 2011 1:54 am

Post by Cue4cheap » Fri Aug 07, 2020 11:52 am

belowcost wrote:
Thu Aug 06, 2020 12:09 pm
I looked at the post and noticed where it mentioned $COST but couldnt determine where to insert the code.

I P.M.'d that page's code to you in hopes you could help. THX
Why do you keep PMing me the code? I am not going to update the code and send the file back to you.
Here is the line with the $cost variable

Code: Select all

'cost'         => $this->currency->convert($cost, 'USD', $this->config->get('config_currency')),
But as a piece of advice hire someone to make changes to your store or buy extensions versus trying to make changes like this.

Mike

cue4cheap not cheap quality


Expert Member

Posts

Joined
Fri Sep 20, 2013 4:45 am
Who is online

Users browsing this forum: RoyT and 144 guests