OpenMage / magento-lts

Official OpenMage LTS codebase | Migrate easily from Magento Community Edition in minutes! Download the source code for free or contribute to OpenMage LTS | Security vulnerability patches, bug fixes, performance improvements and more.
https://www.openmage.org
Open Software License 3.0
870 stars 436 forks source link

Shipping method "Free Shipping" not display when Shipping and Billing addresses are different. #1813

Open PR-Dev27 opened 3 years ago

PR-Dev27 commented 3 years ago

Preconditions (*)

  1. OpenMage LTS 19.4.15/19.4.14 & PHP 7.4

Steps to reproduce (*)

  1. Configure the "Free Shipping" method. image

  2. Add product to the cart which contains price >= 100 image

  3. Process checkout as a Guest User.

  4. Select Ship to different address option from the Billing information. image

Expected result (*)

  1. Should be displayed Free Shipping method regardless of the billing or shipping address values.

Actual result (*)

  1. Free Shipping method not displayed whenever billing & shipping address is different. image
ADDISON74 commented 3 years ago

I've never used that configuration in Settings. My recommendation is to do a Google search for the following words: free shipping magento 1 to understand how this feature works. The solution I used over the years was to create a shopping cart price rule which is very flexible and pretty simple, see bellow.

cart_rules

Here is the User Manual for Magento 1. I would search all references related to free shipping. See one of them at page 597.

https://info2.magento.com/rs/magentosoftware/images/Magento_Community_Edition_User_Guide_Latest.pdf

PR-Dev27 commented 3 years ago

@ADDISON74 - When we select Ship to this address option from the Billing Information at that time it works as expected without creating the Shopping Cart Price Rule.

Anyway, the solution which is provided by you that also full-fill my requirements. Thanks!

ADDISON74 commented 3 years ago

I followed the instructions from this tutorial https://www.youtube.com/watch?v=sU5K44xV4eQ.

I was not able to get in [Estimate Shipping and Tax] block "Free Shipping" in OpenMage 20.0.13, see bellow.

estimate

Now I installed the latest Magento 1.9.4.5 and I did the same steps. The minimum order for free shipping is set to 200. See the results bellow for 100 and 200.

estimate1

estimate2

Once the quantity in cart is changed from 1 to 2 in [Estimate Shipping and Tax] block appears "Free Shipping". It is clear that OpenMage lost this feature but I don't know when and if it is only a template issue or a missing part of the code.

I CONFIRM THIS IMPORTANT BUG!

PS - Maintainers, could you please revise what happened?

ADDISON74 commented 3 years ago

After intensive testing by using any of the lines bellow in /app/code/core/Mage/Tax/etc/config.xml at line 165 solves this issue.

<after>freeshipping</after> => Vanilla Magento 1.9.4.5

or

<after>subtotal,nominal,freeshipping</after> => PR #1104

The variant below is now in all Magento LTS/OpenMage versions but the "Free Shipping" feature no longer works. Before merging PR #1104 it must be evaluated. In fact, what are the differences and real advantages in using the original Magento version or the proposed one.

<after>subtotal,nominal,shipping,freeshipping</after> => Magento LTS/OpenMage all versions

fballiano commented 3 years ago

great find @ADDISON74, I guess it wasn't an easy bug hunt!

I can confirm this problem and the fact that, if "tax_subtotal" depends on "shipping" (like configured in app/code/core/Mage/Tax/etc/config.xml line 165), the getBaseSubtotalInclTax() (app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php line 69) return 0 instead of the actual subtotal.

But that happens only somehow when selecting "ship to different address".

Anyway those lines in app/code/core/Mage/Tax/etc/config.xml were changed in this commit: https://github.com/OpenMage/magento-lts/commit/d92a24aa27360439a6f6ed68ba9260685b2f9e54 but it's really not clear why.

ADDISON74 commented 3 years ago

If @PR-dev27 did not report this bug I don't think we would have ever detected it. It was not very difficult to find the source of trouble because I have patience and I go so far as to install each version until I discover where something has changed for the worse. When I realized that Magento 1.9.4.5 is OK, but Magento LTS 1.9.4.5 not then I dug into the code in a general, fast way. However, it is a feature that could easily be identified as a problem. Moreover, there is even a PR but it lies there like many others.

I have posted so many issues in the Discussion area identified in the code and I see that there are people who are interested in taking them over. Unfortunately not many. We have so many PR's and issues that are not closed to see those that are confirmed which need a fix ASAP.