Page 1 of 1
Override Free Shipping if Discount is Applied?
Posted: Fri Dec 01, 2023 7:42 am
by lecarlb
Hello,
I use the Discount Codes addon on a Phoenix 1.0.8.4 website.
My issue is I don't want the Discount Code and the free shipping to be used together. If the sub-total reaches the threshold for free shipping the the discount won't be allowed.
I've consulted with the maintainer of Discount Codes and it is my understanding that this should be handled with the Order Total module.
Any advisement is appreciated.
Re: Override Free Shipping if Discount is Applied?
Posted: Fri Dec 01, 2023 7:58 am
by raiwa
I answered the question how to do it in the addon's support thread.
I sent you to the public forum because of your question how to override the shipping order total module which is not related to the addon.
Please be precise with the information you provide in your posts.
Re: Override Free Shipping if Discount is Applied?
Posted: Fri Dec 01, 2023 8:27 am
by ecartz
lecarlb wrote: ↑Fri Dec 01, 2023 7:42 am
it is my understanding that this should be handled with the Order Total module.
Which one? If you are modifying the Discount Codes order total module, the check for free shipping would be
Code: Select all
if (ot_shipping::is_eligible_free_shipping($order->delivery['country_id'], $order->info['total'])) {
And you'd pretty much have to modify Discount Codes, since that is the module that you want to disable.
If you do that, make sure that Discount Codes runs after shipping.
Re: Override Free Shipping if Discount is Applied?
Posted: Fri Dec 01, 2023 8:38 am
by lecarlb
ecartz wrote: ↑Fri Dec 01, 2023 8:27 am
lecarlb wrote: ↑Fri Dec 01, 2023 7:42 am
it is my understanding that this should be handled with the Order Total module.
Which one? If you are modifying the Discount Codes order total module, the check for free shipping would be
Code: Select all
if (ot_shipping::is_eligible_free_shipping($order->delivery['country_id'], $order->info['total'])) {
And you'd pretty much have to modify Discount Codes, since that is the module that you want to disable.
If you do that, make sure that Discount Codes runs after shipping.
I have free shipping set to $50 in the Shipping Order Total module and a 10% coupon in Discount Codes. I don't want the customer to have both discounts at the same time. If the $50 threshold is met, then the 10% discount can't be used.
So I'm not sure if the free shipping should be disabled in the Shipping Order Total module or Discount Codes addon if the $50 threshold is met.
(I believe I used the incorrect wording is why I confused things a bit)
Re: Override Free Shipping if Discount is Applied?
Posted: Fri Dec 01, 2023 8:44 am
by ecartz
lecarlb wrote: ↑Fri Dec 01, 2023 7:42 am
If the sub-total reaches the threshold for free shipping the the discount won't be allowed.
Note that this is the opposite of what you requested at
app.php/addons/free_addon/discount_code ... /topic/913
If you want to disable free shipping when a discount code is applied, you have to modify free shipping (in the ot_shipping.php module), that's what you asked about in the add-on forum. If you want to disable discount codes when something is eligible for free shipping (what you're requesting here), you have to modify the discount codes module.
Rainer could do either of those, but it would likely be a chargeable service. I don't know what his availability is. He has contact methods on his website.
If you're doing it yourself, it's possible to override the ot_shipping module, but it requires moving the language files. If you do it on a test store, there will be an error which tells you where it is looking for the language file. Someplace like includes/languages/english/system/override/ot_shipping.php
If you're modifying the discount codes module instead, then you can just edit it directly. You don't need to override it.
Re: Override Free Shipping if Discount is Applied?
Posted: Fri Dec 01, 2023 9:01 am
by lecarlb
If you want to disable free shipping when a discount code is applied, you have to modify free shipping (in the ot_shipping.php module), that's what you asked about in the add-on forum. If you want to disable discount codes when something is eligible for free shipping (what you're requesting here), you have to modify the discount codes module.
Ahhhhh now I see where I screwed up. From a layman's point of view, modifying the ot_shipping.php makes more sense. However, it'll be up to
@raiwa which is best.
Thanks for helping me clear that up.