Override Free Shipping if Discount is Applied?

Open to all! Ask other shopowners for help.
Post Reply
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Override Free Shipping if Discount is Applied?

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
raiwa
Certified Developer
Posts: 1641
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Override Free Shipping if Discount is Applied?

Post 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.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Override Free Shipping if Discount is Applied?

Post 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.
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Re: Override Free Shipping if Discount is Applied?

Post 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)
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Override Free Shipping if Discount is Applied?

Post 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.
lecarlb
Contributor
Posts: 316
Joined: Mon Oct 26, 2020 5:26 pm
Phoenix Version:
Has thanked: 48 times
Been thanked: 9 times

Re: Override Free Shipping if Discount is Applied?

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply