Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong price upon selecting product options after switching currency #7371

Closed
eldonbite opened this issue Nov 9, 2016 · 28 comments
Closed

Wrong price upon selecting product options after switching currency #7371

eldonbite opened this issue Nov 9, 2016 · 28 comments
Labels
bug report Component: Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development

Comments

@eldonbite
Copy link

Encountered an issue when selecting product options using the swatches in product details page wherein the price of the item in a previously selected currency gets displayed instead of the corresponding price in the currently selected currency. Disabling Block HTML cache type seems to prevent this issue from happening.

Preconditions

  1. Magento 2.1.x
  2. Store supports multiple currencies
  3. All cache types are enabled

Steps to reproduce

  1. Select a currency (e.g., GBP) then view a product's details:
    image
  2. Select product options in the current product details page :
    image
  3. Switch to a different currency (e.g., JPY):
    image
  4. Select a product variant; the price reverts back to the previous currency's value but with the current currency's symbol:
    image

Expected result

Correct equivalent price in the current currency should be displayed

Actual result

The price in the previously selected currency gets displayed

@dthampy
Copy link
Contributor

dthampy commented Nov 14, 2016

internal jira to track this : MAGETWO-60977

@eldonbite
Copy link
Author

Updated to Magento 2.1.3 and it seems the issue has worsened. When switching to JPY, the correct price briefly shows up, then suddenly gets multiplied resulting to a very high product price.

Price in AUD after clicking product options:
image

Price in GBP after clicking product options:
image

Price in JPY upon page load:
image

And then after a few seconds or once the document is completely loaded:
image

@erfanimani
Copy link
Contributor

erfanimani commented Dec 23, 2016

Also having this issue.. Upgraded to Magento 2.1.3 and getting really odd prices until you select a swatch. Using configurable products w/ swatches and multi-currency. Unlike @eldonbite , it's still happening for me when I disable block cache.

edit: actually, sometimes choosing a swatch doesn't fix the price..

@erfanimani
Copy link
Contributor

@dthampy There's already MAGETWO-62682, which should be the same as MAGETWO-60977, no?

@dthampy
Copy link
Contributor

dthampy commented Jan 13, 2017

@erfanimani, MAGETWO-62682 created for tracking #7941 is a duplicate.

@ovekeryk
Copy link

The same issue. Do you have a quick fix?

@erfanimani
Copy link
Contributor

@AlexanderVekerik No quick fix as far as I'm aware. Do post it if you figure it out.

@finepos
Copy link

finepos commented Jan 22, 2017

Same bug, Who knows when it will be fixed?

@QuentinHK
Copy link

Same bug here, Magento 2.1.3, double conversion rate with all configurable products when no options selected and displaying prices in a different currency than the base currency.
Did anyone figure out a fix, please?

@erfanimani
Copy link
Contributor

erfanimani commented Feb 8, 2017

Doesn't seem it got fixed in 2.1.4 :(

@hectornguyen
Copy link

@erfanimani It's predictable, mate. It won't fixed till Magento 3, I guess.

@orlangur orlangur mentioned this issue Feb 22, 2017
@erfanimani
Copy link
Contributor

mmansoor-magento pushed a commit that referenced this issue Feb 25, 2017
 - Merge Pull Request #8593 from rossluk/magento2:patch-1
@erfanimani
Copy link
Contributor

@mmansoorebay Actually, this needs to be re-opened. The main issue here doesn't seem to have been solved and is still happening for me on a stock M2.1.4 install: When on a configurable product page and having selected a different currency than the base one - correct price shows up briefly, then gets swapped out for a wrong value which seems to have double conversion rate applied. Regardless of using catalog rule discounts or not.

To be exact, the correct price shows up, until the priceBox JS module is loaded. priceBox gets its config from Magento\Catalog\Block\Product\View::getJsonConfig, and I'm assuming there's a double conversion going on in there for configurable products and it's chosen as the minimum price, until an option is chosen. Hope that helps - will look into it some more.

CC @orlangur

@erfanimani
Copy link
Contributor

erfanimani commented Feb 25, 2017

Actually, disregard my comment. The fix for the double conversion seems to have been pulled into the development branch of Magento 2 - I didn't see the diff for it referenced in this thread, so assumed it wasn't fixed. @mmansoorebay @orlangur

Diff/patches:

edit: and it was fixed back in November (but never pulled into a release), before this issue was even created! :') I guess the joke's on me

@orlangur
Copy link
Contributor

Hi @erfanimani, I cannot give you any official answer or reopen ticket anyway as I'm not a part of Magento :)

For such cases - when issue is really important, fixed but not backported to 2.1.x yet - it may be worth reporting new issue explicitly stating 2.1.x problem referring to this one and appropriate commit. It is especially useful with reference to commits - if you cherry-picked some from develop and it fixed the problem for your 2.1.x instance - as it would simplify backporting.

I saw in some other ticket here statement "there are lot of fixes not backported, vote for important ones so that we can define priorities".

@erfanimani
Copy link
Contributor

erfanimani commented Feb 26, 2017

Thanks @orlangur, I do think this issue is really important - it essentially prevents stores from using configurable products in combination with multi-currency (and I don't understand why not more people are complaining about it).

I think at least Magento should put a message in the ticket saying that the fix for this is already in the development branch. I only found out after figuring out exactly where in the code the bug is located, and then looking in the development branch and seeing that it was already fixed, almost half a year ago.

I don't like opening a new Github issue though - there are already so many new tickets being created, and it seems to be a massive overhead for them to filter through it, and it doesn't seem the right place to report a backport. Maybe I'll try the forums.

Anyhow, for anyone looking to solve the same bug - it's already fixed in the two commits I posted earlier. Keep in mind that, when "patching" through DI/preference, you'll also need to add the getCacheKeyInfo to Magento\Swatches\Block\Product\Renderer\Configurable.

CC @dthampy

@nntoan
Copy link
Contributor

nntoan commented Mar 9, 2017

@erfanimani Regarding to your previous comment, could you give me a lead about

Keep in mind that, when "patching" through DI/preference, you'll also need to add the getCacheKeyInfo to Magento\Swatches\Block\Product\Renderer\Configurable.

Are you mean Magento\ConfigurableProduct\Block\Product\View\Type\Configurable? Because that is the class name which added getCacheKeyInfo in the two commits you posted.

Thanks.

@erfanimani
Copy link
Contributor

erfanimani commented Mar 9, 2017 via email

@nntoan
Copy link
Contributor

nntoan commented Mar 10, 2017

@erfanimani I don't know how could you solve this problem, but seem this pull request can't work for me.

I added getCacheKeyInfo to Magento\Swatches\Block\Product\Renderer\Configurable.
The price is not correct after you choose a new currency, for e.g 32AUD -> 10.37GBP (must be 18.36GBP). This price is only correct if I choose a swatch, the first load of configurable product doesn't display the correct price....

Do you have any idea about this?

@erfanimani
Copy link
Contributor

erfanimani commented Mar 10, 2017

@nntoan Sorry no, I did exactly the same as that PR, except that I also added the getCacheKeyInfo method to Magento\Swatches\Block\Product\Renderer\Configurable (in addition to Magento\ConfigurableProduct\Block\Product\View\Type\Configurable.

That did the job for me.

There's also another issue related to this one, and it seems if you have catalog price rules, the same symptoms of this bug happen.

@niko7869
Copy link

niko7869 commented Sep 9, 2017

@orlangur can you help me with this currency issue for my multi store view multi currency site ?please

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development bug report Component: Catalog labels Sep 9, 2017
@orlangur
Copy link
Contributor

@niko7869 please check 2.1-develop branch first, this issue was probably fixed in #9841. If not, two comments by @erfanimani #7371 (comment) and #7371 (comment) are probably describing solution which worked for him.

@niko7869
Copy link

@oroskodias thank you for reply but i dont know what to do as i m not developer :(

@korostii
Copy link
Contributor

i dont know what to do as i m not developer :(

@niko7869 Have you tried hiring a developer? =)

Otherwise you're largely on your own. This is a bugtracker, not a help desk.
If you are looking for help or an advice, you might have better chances on the Community Forums or the Magento Stack Exchange

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Sep 12, 2017
@niko7869
Copy link

niko7869 commented Sep 12, 2017

@korostii thank you for your opinion about the issue :)

@traff1kash
Copy link

Not sure if this is the correct solution, but this worked for me on 2.1.9.

Changed vendor\magento\module-catalog\Block\Product\View.php Line: 237-262 with this code:

$config = [
            'productId' => $product->getId(),
            'priceFormat' => $this->_localeFormat->getPriceFormat(),
            'prices' => [
                'oldPrice' => [
                    'amount' => 
                        $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue()
                    ,
                    'adjustments' => []
                ],
                'basePrice' => [
                    'amount' => 
                        $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount()
                    ,
                    'adjustments' => []
                ],
                'finalPrice' => [
                    'amount' => 
                        $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue()
                    ,
                    'adjustments' => []
                ]
            ],
            'idSuffix' => '_clone',
            'tierPrices' => $tierPrices
        ];

@nntoan
Copy link
Contributor

nntoan commented Oct 26, 2017

@traff1kash That's a different story, this is reproducible after you setup catalog price rule.

@ghost
Copy link

ghost commented Nov 22, 2017

@traff1kash Thanks for posting solution. Your solution work for me.

magento-devops-reposync-svc pushed a commit that referenced this issue Apr 12, 2022
…ync-122321

Final sync of 2.4.4-develop with 2.4-develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Catalog Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

No branches or pull requests