-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
M2.1.1 : Cannot get quote details #6624
Comments
The weird part is also, that when I put the following code in the constructor of my custom block:
I get the following result:
But ... when I past the same code in the constructor of
Does anyone have a clue why this could be? I just invoke the checkout session using dependency injection in my constructor. How come that one class has the correct items filled and the other hasn't? It is the same session! |
More debugging: the method Why don't I have a session in my custom block? When I manually invoke |
Another interesting fact: in my constructor |
Got it! Once again it wasn't a bug, but a feature. Turns out that if your blocks are cacheable and cache is enabled, there is a little something called So, to make a long story short and to close my couple of hours of debugging: if you need stuff from your checkout session, make sure your block isn't cached. A simple
I hope this saves somebody a couple of hours of frustration and debugging. |
Really helpful, thank you. This fixed it for me on all pages but not on the Product Description Page. |
I am using magento 2.1.8. I my custom theme app\design\frontend\Sample\theme-frontend-shop\Magento_Catalog\templates\product\view\form.phtml I have done `
} echo $currentItemCount; and in my app\design\frontend\Sample\theme-frontend-shop\Magento_Catalog\layout\catalog_product_view.xml I have added But this is not working properly when full page cache is enabled. Need help to fix this issue. |
thanks a lot :) |
@kanduvisla Should be added to documentation! |
Have a problem with the mincart in 2.3 when FPC i enable and it drop the items if I visit a page that has not been cached. Is it possible for me to exclude the minicart from the cache nad how do I do it? |
When I try to get quote details, my quote does not seem to get loaded from my session.
Preconditions
Steps to reproduce
Code sample (in a custom block):
Now if I cal
$this->getQuote()->getId()
it returnsNULL
, even though the quote is saved and all in the database.Expected result
Actual result
The text was updated successfully, but these errors were encountered: