Open Genaker opened 6 months ago
Hi @Genaker. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@magento I am working on this
Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
there is test cases:
$customer = $this->customerRepository->getById($customerId);
$output->writeln('is order for guest : ' . $quote->getCustomerIsGuest());
$output->writeln("Customer ID:" . $customer->getId());
// Assign the customer to the quote
$quote->assignCustomer($customer);
$quote->setCustomerId($customer->getId());
$output->writeln('is order for guest after assign customer and set customer ID : ' . $quote->getCustomerIsGuest());
$output->writeln('is order for guest after set setCustomerIsGuest : ' . $quote->getCustomerIsGuest());
output 👍
the same issue for quote/cart or for order doesn't matte. please fix this issue in the core.
Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Hello @Genaker,
Thank you for the report and contribution!
Tried to verify this issue on 2.4-develop, but in our case it is not reproducible.
Signed in as a customer, and added the product to cart, but customer_is_guest
was 0
.
Please take a look at the screenshot below:
Please let us know if any preconditions are required for the issue to be reproduced, and also if we are missing anything.
Thank you.
You should submit an order not through the front but by code: it is not a front issue
$quoteMaskedHash = //Real cart with the items mask
$quoteId = $this->getQuoteIdFromMaskedHash($quoteMaskedHash);
$customerId = //SomeCustomerID
$quote = $this->quoteRepository->get($quoteId);
$customer = $this->customerRepository->getById($customerId);
// Assign the customer to the quote there quote must be not guest
$quote->assignCustomer($customer);
$billingAddress = [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'test@test.com',
'street' => '123 Main St',
'city' => 'Anytown',
'country_id' => 'US',
'region' => 'NY',
'postcode' => '12345',
'telephone' => '1234567890',
'save_in_address_book' => 0
];
$quote->getBillingAddress()->addData($billingAddress);
$shippingAddress = [
'firstname' => 'John',
'lastname' => 'Doe',
'email' => 'test@test.com',
'street' => '123 Main St',
'city' => 'Anytown',
'country_id' => 'US',
'region' => 'NY',
'postcode' => '12345',
'telephone' => '1234567890',
'save_in_address_book' => 0
];
$quote->getShippingAddress()->addData($shippingAddress);
$shippingAddress = $quote->getShippingAddress();
$shippingAddress->setCollectShippingRates(true)
->collectShippingRates()
->setShippingMethod('freeshipping_freeshipping'); // For Free Shipping
$quote->setPaymentMethod('checkmo'); // For Check / Money order
$quote->setInventoryProcessed(false); // Prevents inventory decrement
$quote->getPayment()->importData(['method' => 'checkmo']);
// Attempt to save the quote and create an order from it
$quote->collectTotals()->save();
///Quote is still guest
Hello @Genaker,
Thank you for the quick response!
Verified this issue on 2.4-develop.
When checking out from a guest quote programmatically, after assigning a customer to the quote, customer_is_guest
remains 1
.
Please take a look at the screenshot below:
The value of customer_is_guest
should have been 0
, but it remains 1
.
Hence confirming this issue.
Please find the custom module used to reproduce this issue. I38540V.zip
Thank you.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11689 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
:x: You don't have permission to export this issue.
@magento I am working on this
https://github.com/magento/magento2/blob/a98a64a73a72b7bb7bf297d3aba5f9920c8a2b70/app/code/Magento/Quote/Model/Quote.php#L859-L861
if ($this->_customer) { $this->setCustomerId($this->_customer->getId()); }
You need to change it to
if ($this->_customer) { $this->setCustomerId($this->_customer->getId()); $this->setCustomerIsGuest(0); }
or incapsulate this logic into setCustomerId() method
Additional Information: This issue is caused when checking out from a guest cart programmatically, when you assign a customer to the cart before submitting it to place the order, the quote remains as guest even though a customer has been assigned.