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

Save quote to cart repository #162

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JeroenBoersma
Copy link

Save the quote as soon as posible to the cart repository to make sure it will become generally available during the execution of code.

$quote->save(); // does not register the quote in the repository

// ... snap
\Magento\Quote\Model\QuoteManagement::placeOrder($quote->getId());
// this will reload the quote

```

`$quote->setInventoryProcessed` is a in memory field only and the state is lost when it will be reloaded from the database

Save the quote as soon as posible to the cart repository to make sure it will become generally available during the execution of code.

````php
$quote->save(); // does not register the quote in the repository

// ... snap
\Magento\Quote\Model\QuoteManagement::placeOrder($quote->getId());
// this will reload the quote

```

`$quote->setInventoryProcessed` is a in memory field only and the state is lost when it will be reloaded from the database
in the repository the current item is unset instead of set/overwritten
force object reload and registering in memory
same quote object is used for the placeOrder
@JeroenBoersma
Copy link
Author

Please wait merging...

We run into a problem where customer addresses break if a customer exists and the shipping country is changed.
Tried with the save customer option disabled, than it works if the customer account doesn't exist in Magento.

The final order will have the wrong address, our investigation took several days, so need to come back at this at a later time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant