How to reload the quote or cart in Magento 2Reload Quote In Controller Action$quote->setHasErrors(true); not workingMagento 2 : Update Cart summary htmlMagento 2.x - Adding product to quote, but quote is not stored in properlyMagento 2 reload cart page total sectionM2: Wrong totals, if I change item customPrice after quote->collectTotals()How to Refresh/reload Magento 2 Quote Object in checkout session/pageMagento 2.2.6: Mini cart qty not updated after I add cart items programaticallyAdd product to quote in admin programmatically magento 2update reward points and recollect the quote total and list the discount with reward points
What *exactly* is electrical current, voltage, and resistance?
Creating a chemical industry from a medieval tech level without petroleum
Can a level 2 Warlock take one level in rogue, then continue advancing as a warlock?
What is the most expensive material in the world that could be used to create Pun-Pun's lute?
How do I reattach a shelf to the wall when it ripped out of the wall?
Combinatorics problem, right solution?
A faster way to compute the largest prime factor
Restricting the options of a lookup field, based on the value of another lookup field?
What is the unit of time_lock_delta in LND?
How bug prioritization works in agile projects vs non agile
Extracting Dirichlet series coefficients
Is it acceptable to use working hours to read general interest books?
How much cash can I safely carry into the USA and avoid civil forfeiture?
Was Dennis Ritchie being too modest in this quote about C and Pascal?
Is there a better way to say "see someone's dreams"?
Contradiction proof for inequality of P and NP?
How exactly does Hawking radiation decrease the mass of black holes?
Is Diceware more secure than a long passphrase?
Work requires me to come in early to start computer but wont let me clock in to get paid for it
What to do with someone that cheated their way through university and a PhD program?
Is there really no use for MD5 anymore?
Find the identical rows in a matrix
Which big number is bigger?
How to pronounce 'c++' in Spanish
How to reload the quote or cart in Magento 2
Reload Quote In Controller Action$quote->setHasErrors(true); not workingMagento 2 : Update Cart summary htmlMagento 2.x - Adding product to quote, but quote is not stored in properlyMagento 2 reload cart page total sectionM2: Wrong totals, if I change item customPrice after quote->collectTotals()How to Refresh/reload Magento 2 Quote Object in checkout session/pageMagento 2.2.6: Mini cart qty not updated after I add cart items programaticallyAdd product to quote in admin programmatically magento 2update reward points and recollect the quote total and list the discount with reward points
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am working on ajax cart.
When i update the cart qty, I am trying to reload the quote but its not loading properly
$this->cart->getQuote()->getShippingAddress()->collectShippingRates()->save();
$this->cart->getQuote()->setTotalsCollectedFlag(false);
$this->cart->getQuote()->collectTotals();
$this->cart->getQuote()->save();
How to reload the quote so that total calculation should happen properly
in magento1 we use cart::init()
magento2 cart quote totals
add a comment |
I am working on ajax cart.
When i update the cart qty, I am trying to reload the quote but its not loading properly
$this->cart->getQuote()->getShippingAddress()->collectShippingRates()->save();
$this->cart->getQuote()->setTotalsCollectedFlag(false);
$this->cart->getQuote()->collectTotals();
$this->cart->getQuote()->save();
How to reload the quote so that total calculation should happen properly
in magento1 we use cart::init()
magento2 cart quote totals
1
did you get any success on this?
– Pallavi
Nov 3 '16 at 12:22
did you get any success on this? i am getting same problem
– Navin Bhudiya
Feb 15 '18 at 8:42
add a comment |
I am working on ajax cart.
When i update the cart qty, I am trying to reload the quote but its not loading properly
$this->cart->getQuote()->getShippingAddress()->collectShippingRates()->save();
$this->cart->getQuote()->setTotalsCollectedFlag(false);
$this->cart->getQuote()->collectTotals();
$this->cart->getQuote()->save();
How to reload the quote so that total calculation should happen properly
in magento1 we use cart::init()
magento2 cart quote totals
I am working on ajax cart.
When i update the cart qty, I am trying to reload the quote but its not loading properly
$this->cart->getQuote()->getShippingAddress()->collectShippingRates()->save();
$this->cart->getQuote()->setTotalsCollectedFlag(false);
$this->cart->getQuote()->collectTotals();
$this->cart->getQuote()->save();
How to reload the quote so that total calculation should happen properly
in magento1 we use cart::init()
magento2 cart quote totals
magento2 cart quote totals
edited Sep 8 '18 at 16:38
Mohamed El Mrabet
823517
823517
asked Jun 15 '16 at 5:23
Pradeep KumarPradeep Kumar
5,53674377
5,53674377
1
did you get any success on this?
– Pallavi
Nov 3 '16 at 12:22
did you get any success on this? i am getting same problem
– Navin Bhudiya
Feb 15 '18 at 8:42
add a comment |
1
did you get any success on this?
– Pallavi
Nov 3 '16 at 12:22
did you get any success on this? i am getting same problem
– Navin Bhudiya
Feb 15 '18 at 8:42
1
1
did you get any success on this?
– Pallavi
Nov 3 '16 at 12:22
did you get any success on this?
– Pallavi
Nov 3 '16 at 12:22
did you get any success on this? i am getting same problem
– Navin Bhudiya
Feb 15 '18 at 8:42
did you get any success on this? i am getting same problem
– Navin Bhudiya
Feb 15 '18 at 8:42
add a comment |
1 Answer
1
active
oldest
votes
I hope this may helps you
After add to cart run this code:
use MagentoFrameworkSessionSessionManagerInterface;
use MagentoFrameworkStdlibCookieCookieMetadataFactory;
use MagentoFrameworkStdlibCookiePublicCookieMetadata;
use MagentoFrameworkStdlibCookieManagerInterface;
in constructor:
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
SessionManagerInterface $sessionManager,
After product was added to cart
$metadata = $this->_cookieMetadataFactory
->createPublicCookieMetadata()
->setPath('/');
$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));
$sectiondata->cart += 1000;
$this->_cookieManager->setPublicCookie(
'section_data_ids',
json_encode($sectiondata),
$metadata
);
Before trying above code try with frontend/section.xml :
<action name="NAMESPACE/MODULE/CARTUPDATE/">
<section name="cart"/>
</action>
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f120933%2fhow-to-reload-the-quote-or-cart-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I hope this may helps you
After add to cart run this code:
use MagentoFrameworkSessionSessionManagerInterface;
use MagentoFrameworkStdlibCookieCookieMetadataFactory;
use MagentoFrameworkStdlibCookiePublicCookieMetadata;
use MagentoFrameworkStdlibCookieManagerInterface;
in constructor:
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
SessionManagerInterface $sessionManager,
After product was added to cart
$metadata = $this->_cookieMetadataFactory
->createPublicCookieMetadata()
->setPath('/');
$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));
$sectiondata->cart += 1000;
$this->_cookieManager->setPublicCookie(
'section_data_ids',
json_encode($sectiondata),
$metadata
);
Before trying above code try with frontend/section.xml :
<action name="NAMESPACE/MODULE/CARTUPDATE/">
<section name="cart"/>
</action>
add a comment |
I hope this may helps you
After add to cart run this code:
use MagentoFrameworkSessionSessionManagerInterface;
use MagentoFrameworkStdlibCookieCookieMetadataFactory;
use MagentoFrameworkStdlibCookiePublicCookieMetadata;
use MagentoFrameworkStdlibCookieManagerInterface;
in constructor:
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
SessionManagerInterface $sessionManager,
After product was added to cart
$metadata = $this->_cookieMetadataFactory
->createPublicCookieMetadata()
->setPath('/');
$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));
$sectiondata->cart += 1000;
$this->_cookieManager->setPublicCookie(
'section_data_ids',
json_encode($sectiondata),
$metadata
);
Before trying above code try with frontend/section.xml :
<action name="NAMESPACE/MODULE/CARTUPDATE/">
<section name="cart"/>
</action>
add a comment |
I hope this may helps you
After add to cart run this code:
use MagentoFrameworkSessionSessionManagerInterface;
use MagentoFrameworkStdlibCookieCookieMetadataFactory;
use MagentoFrameworkStdlibCookiePublicCookieMetadata;
use MagentoFrameworkStdlibCookieManagerInterface;
in constructor:
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
SessionManagerInterface $sessionManager,
After product was added to cart
$metadata = $this->_cookieMetadataFactory
->createPublicCookieMetadata()
->setPath('/');
$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));
$sectiondata->cart += 1000;
$this->_cookieManager->setPublicCookie(
'section_data_ids',
json_encode($sectiondata),
$metadata
);
Before trying above code try with frontend/section.xml :
<action name="NAMESPACE/MODULE/CARTUPDATE/">
<section name="cart"/>
</action>
I hope this may helps you
After add to cart run this code:
use MagentoFrameworkSessionSessionManagerInterface;
use MagentoFrameworkStdlibCookieCookieMetadataFactory;
use MagentoFrameworkStdlibCookiePublicCookieMetadata;
use MagentoFrameworkStdlibCookieManagerInterface;
in constructor:
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory,
SessionManagerInterface $sessionManager,
After product was added to cart
$metadata = $this->_cookieMetadataFactory
->createPublicCookieMetadata()
->setPath('/');
$sectiondata = json_decode($this->_cookieManager->getCookie('section_data_ids'));
$sectiondata->cart += 1000;
$this->_cookieManager->setPublicCookie(
'section_data_ids',
json_encode($sectiondata),
$metadata
);
Before trying above code try with frontend/section.xml :
<action name="NAMESPACE/MODULE/CARTUPDATE/">
<section name="cart"/>
</action>
edited Sep 8 '18 at 16:38
Mohamed El Mrabet
823517
823517
answered Feb 16 '18 at 3:32
Pradeep KumarPradeep Kumar
5,53674377
5,53674377
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f120933%2fhow-to-reload-the-quote-or-cart-in-magento-2%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
did you get any success on this?
– Pallavi
Nov 3 '16 at 12:22
did you get any success on this? i am getting same problem
– Navin Bhudiya
Feb 15 '18 at 8:42