Post by KDNovelties » Wed Nov 22, 2017 12:26 am

Hi everyone. Is there an option for to set free shipping based on total not subtotal. When someone uses a coupon, it drops their total below the free shipping amount, but they still get free shipping, which is not what is needed. What I've done so far, but has not worked is change getSubTotal to getTotal in catalog/model/extension/shipping/free.php

Any help would be greatly appreciated.

User avatar
New member

Posts

Joined
Sat May 27, 2017 12:12 am

Post by thekrotek » Wed Nov 22, 2017 5:12 am

Put Shipping order total BELOW the Coupon and see, how it works.

Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com


User avatar
Active Member

Posts

Joined
Sun Jul 03, 2016 12:24 am


Post by KDNovelties » Wed Nov 22, 2017 7:39 am

Thanks, shipping order total was already below the coupon. I changed it to be on top and same thing. From what I understand, that only changes the sort order. Not any calculations. There should be a way of doing this.

User avatar
New member

Posts

Joined
Sat May 27, 2017 12:12 am

Post by KDNovelties » Wed Nov 22, 2017 8:27 am

So I was able to put this together, however, it only works if the page is refreshed... Any help appreciated. Thanks

Code: Select all

	<file name="catalog/model/extension/total/coupon.php">
		<operation>
			<search position="before"><![CDATA[$total['total'] -= $discount_total;]]></search>
			<add><![CDATA[$this->session->data['coupon_discount'] = $discount_total;]]></add>
		</operation>		
	</file>

	<file name="catalog/model/extension/shipping/free.php">
		<operation>
			<search position="before"><![CDATA[$method_data = array();]]></search>
			<add><![CDATA[        if ( (isset($this->session->data['coupon']) && ($this->session->data['coupon'] != '')) &&
             (isset($this->session->data['coupon_discount']) && ($this->session->data['coupon_discount'] != '')) ) {

             $coupon_discount = $this->session->data['coupon_discount'];

             if ($this->cart->getSubTotal() < ($this->config->get('free_total') + $coupon_discount)) {
                 $status = false;
             }
        }]]>
			</add>
		</operation>		
	</file>

User avatar
New member

Posts

Joined
Sat May 27, 2017 12:12 am

Post by Johnathan » Wed Nov 22, 2017 11:13 pm

You don't need to change the coupon Order Total, what you need is a shipping method that can base its calculation on the full total at the point of the "Shipping" line item. Total-Based Shipping can do this, so that you can use the sub-total + coupon + other line items that come before "Shipping". For example:

------------------------------------------------------------------------------
CHARGE #1
Title: Free Shipping Over $100
Sort Order: 1
Charge Field: 100-99999 = 0
Rule: Total Value = Total
------------------------------------------------------------------------------

Feel free to take a look at the screenshots and demo site, and if you're interested let me know at www.getclearthinking.com/contact if you have any further questions.

Image
Image Image Image Image Image Image


User avatar
Global Moderator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by glolar » Fri Apr 06, 2018 2:51 am

In my opinion, this is a BUG in OpenCart. Determination to show Free Shipping option or not should be determined after taking discount coupons into consideration. Has anyone found a fix for this, short of having to buy an Extension to fix this?

Increase Your Child's I.Q.
iPad Wallpapers
Turtle & Tortoise Screen Savers


User avatar
Active Member

Posts

Joined
Thu Jul 29, 2010 12:35 pm
Location - San Diego, CA
Who is online

Users browsing this forum: No registered users and 6 guests