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
Expert 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


User avatar
Administrator

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

Post by littleredcar » Sat Aug 15, 2020 1:48 am

same problem here. :'(

anyone found a solution to this (i am using 2.3.0.2)?
i already bought 'total-based shipping' from jonathan. but shipping costs still get calculated the WRONG way. if total drops below free shipping AFTER applying a discount, customers get free shipping IN ADDITION to the discount - which is kinda... STUPID!

there must be a solution to change CALCULATION ORDER, not only SORTING ORDER in cart + checkout... ???

---
Environment
php: 7.2
MySQL: 5.7.26
Browser: Chrome latest

---
OpenCart
2.3.0.2 singlestore (bugfree edition by xxvirusxx: https://github.com/condor2/Opencart_2302)
DE language by OSWorX (https://www.opencart.com/index.php?rout ... n_id=31048)
Template: Sellmore by 321cart
quite a few Extensions :-)


Active Member

Posts

Joined
Thu Jul 30, 2009 4:21 pm

Post by littleredcar » Sat Aug 15, 2020 5:39 pm

Johnathan kindly solved this! :drunk:

thats something OC cant do out of the box. so go ahead and get his total-based extension https://www.opencartx.com/total-based-shipping.
highly recommended - and support is top-notch!!

cheers, johnathan

---
Environment
php: 7.2
MySQL: 5.7.26
Browser: Chrome latest

---
OpenCart
2.3.0.2 singlestore (bugfree edition by xxvirusxx: https://github.com/condor2/Opencart_2302)
DE language by OSWorX (https://www.opencart.com/index.php?rout ... n_id=31048)
Template: Sellmore by 321cart
quite a few Extensions :-)


Active Member

Posts

Joined
Thu Jul 30, 2009 4:21 pm

Post by Johnathan » Sat Aug 15, 2020 10:59 pm

Thanks, glad I could help. If anyone else has problems with my extension, feel free to reach out here:

www.getclearthinking.com/contact

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am

Who is online

Users browsing this forum: No registered users and 180 guests