Post by pratik.shah » Mon Jan 16, 2012 8:47 pm

Greetings to all,

I want to customize built-in free shipping over $xxx limiting to only default group of customers.

Can anyone help me with the code to be added to php?

Corel Insight Store


Newbie

Posts

Joined
Thu Jun 23, 2011 6:51 pm

Post by webvet » Mon Jan 16, 2012 10:14 pm

Have you looked at this extension http://forum.opencart.com/viewtopic.php?f=124&t=39792? It links shipping options to customer group.

Or for more options try putting
shipping based on customer group
into the search facility

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by nitsak » Wed Apr 01, 2015 4:03 pm

Hi, I just had the same request and buying an extension seemed extreme. Here's what I found to work on my site (1.5.5.1)

Open "Catalog/model/shipping/free.php" and go to line 19, between:

Code: Select all

if ($this->cart->getSubTotal() < $this->config->get('free_total')) {
			$status = false;
		}
and

Code: Select all

$method_data = array();
Now we want to add another condition to stop keep the option disabled (the bottom if statement on the php file makes it enabled)

Paste the following just above the "$method_data = array();":

Code: Select all

if ($this->customer->getCustomerGroupId() <> 1) {
			$status = false;
		}
		
The assumption here is that you will only be allowing free shipping to the default customer group (id =1), you can modify the if statement to suit your requirements.

Hope this helps

Newbie

Posts

Joined
Fri Apr 25, 2014 4:37 pm

Post by jkitz » Sat Sep 24, 2016 6:53 am

Just wondering if there may be an equivalent to this for 2.3?

When I try this method it informs me that the getCustomerGroupId() function doesn't exist.

The relevant file is in a different location of course:
catalog/model/extension/shipping/free.php

Newbie

Posts

Joined
Thu Sep 01, 2016 10:28 am
Location - Ottawa, Canada

Post by Johnathan » Sat Sep 24, 2016 11:11 pm

That function was renamed a few versions ago. Using this edit should work:

Code: Select all

IN:
/catalog/model/extension/shipping/free.php

BEFORE:
if ($status) {

ADD:
if ($this->customer->getGroupId() != 1) {
    $status = false;
}

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by jkitz » Sun Sep 25, 2016 12:09 pm

Johnathan wrote:That function was renamed a few versions ago. Using this edit should work:

Code: Select all

IN:
/catalog/model/extension/shipping/free.php

BEFORE:
if ($status) {

ADD:
if ($this->customer->getGroupId() != 1) {
    $status = false;
} 
Thanks Johnathan, this worked like a charm.

Newbie

Posts

Joined
Thu Sep 01, 2016 10:28 am
Location - Ottawa, Canada
Who is online

Users browsing this forum: No registered users and 14 guests