KirkM Posted November 26, 2021 Share Posted November 26, 2021 Interesting situation with a client on CC 6.4.4: He has shipping set up for a fixed rate of $7.95 for orders $0 - $48.99. He has another rate of free shipping for $49.00 - $100,000. He also has a coupon for $15 off for new customers. He needs the coupon to be subtracted BEFORE the store calculates the shipping rate. Here what is happening: Product Z 49.96 Subtotal 49.96 Certificate -15.00 Free Shipping Total 34.96 What he needs: Product Z 49.96 Certificate -15.00 Subtotal 34.96 Ship Charge 7.95 Total 42.91 I don't see a way to get this to happen. Anyone know if this is possible? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 26, 2021 Share Posted November 26, 2021 Interesting question. Having given it some initial thought, I think the best approach is modify the shipping module, rather than the sequence CubeCart takes in processing the checkout vis-a-vis the coupon discount. What shipping module is being used? Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 26, 2021 Author Share Posted November 26, 2021 All in one shipping. What I was thinking was that the coupon should have the user choice of either calculating on the subtotal or as part of the calculation of the subtotal. That way the shipping or any other module can stay looking at the subtotal for their calculations. It would be a really nice flexibility feature in the coupon module. 1 Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 29, 2021 Author Share Posted November 29, 2021 Been trying to figure out a way to get the coupon to be part of the calculation of subtotal. The more I examine the function of the cart / checkout process from the store owner's point of view and possible marketing approaches, the more I see that the coupon logic is deficient in it's ability to be used in conjunction with other marketing tools. I realize my point of view is rather simplistic since I am not intimately familiar with the code, but I have been reading through the relevant scripts and it seems that even with the complication of coupons for particular products or other variables, those discounts should be taken BEFORE the subtotal that all other things act upon, like shipping. Do you have any suggestions or ideas of how to hack this? Combining coupons with variable shipping zones / rates is pretty common for my client and seems to me to be a pretty basic marketing approach. Thanks. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2021 Share Posted November 29, 2021 Still looking on how to hack this. But from your description in the OP, comparing how you describe what you are after, it seems to me there is some confusion. You want the coupon to apply its calculations to the subtotal? Or (I think actually) you want the coupon to apply its calculations to one or more of the line items' "full retail price"? The "What he needs" detail above seems to suggest there is to be a discount applied to Product Z (whatever you wish Product Z to mean). I am focusing on the AIOS module. Quote Link to comment Share on other sites More sharing options...
KirkM Posted November 29, 2021 Author Share Posted November 29, 2021 Sorry, I realize this is not really clear. The example of what he needs is over-simplified with just the one product. There could be multiple products. The coupon in this case is for $15 off the whole order. Plus, his promotion also has free shipping for all orders $49 or more. He needs the shipping to be considered AFTER all coupons and any other discounts are deducted. The way the store works now, the coupon looks at the subtotal and the shipping looks at the subtotal ignoring the subtraction for the coupon, because the coupon also happens AFTER the subtotal. There is no consideration by the shipping for a modified subtotal because of the coupon. He will always need the shipping promotion to be on the final amount AFTER any discounts. To me, he is right, that is the way this should work or at least have the option for it to work that way. I hope that is a bit clearer on what the issue is with the current way CC handles the checkout flow. Quote Link to comment Share on other sites More sharing options...
KirkM Posted December 1, 2021 Author Share Posted December 1, 2021 This is commented in the AIOS class: $this->_value = (float)$this->_basket['subtotal']; // XXX May want to remove coupon discount, i.e. // $this->_value -= $this->_basket['discount']; Could it really be as easy as uncommenting that line of code? 1 Quote Link to comment Share on other sites More sharing options...
KirkM Posted December 1, 2021 Author Share Posted December 1, 2021 (edited) Well, I feel like an idiot (not the first time). I was totally focused on where the coupon was applied and not on the shipping module. Uncommenting that line of code did the trick and makes perfect sense. It was right there in the shipping.class.php file, with a big flag of a comment to tell dummies like me "HEY! right here!". Sheesh. Thanks Brian for always jumping in to help. Your remark made me take a look over at the AIOS class after being so focused on the coupon class code. Edited December 1, 2021 by KirkM Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 1, 2021 Share Posted December 1, 2021 And I had, in the past for earlier solutions to problems, carefully scanned the AIOS code and, in diving in to solve this problem, completely forgot there was this line of code ready for this solution! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.