magento / inventory

Magento Inventory Project (a.k.a MSI)
Open Software License 3.0
338 stars 248 forks source link

"Quote does not have Pickup Location assigned." in Instant Purchase with Pickup Store #3267

Open ghost opened 3 years ago

ghost commented 3 years ago

Hello guys,

we developed a payment module with the Vault feature(https://github.com/dholidev/module-payu). Instant Purchase worked perfectly well with the other shipping methods, however, when using the new "Pickup Store" feature of Magento 2.4.0, it is not possible to finalize the purchase on the product page. We are getting the message "Quote does not have Pickup Location assigned.".

Looking at the documentation below, I found no restrictions to finalize the purchase using "Instant Purchase" with "Pickup Store".

Looking at the source code of the Magento\InventoryInStorePickupQuote\Model\Quote\ValidationRule\InStorePickupQuoteValidationRule file, line 116, the value returned from $address->getExtensionAttributes()->getPickupLocationCode() is empty.

As it is not the function of the Payment Method to set the value to "PickupLocationCode", I ask you if this is a bug in Magento 2.4.0 or a limitation like "Instant Purchase cannot be used with Braintree Credit Cards if 3D Secure is enabled. " found at this link https://docs.magento.com/user-guide/sales/checkout-instant-purchase.html.

You can reproduce the error with this product https://payu.dholi.dev/joust-duffle-bag.html, using the test cards from this link https://docs.dholi.dev/en/payu/sandbox.

Best Regards, Rodrigo

error InStorePickupQuoteValidationRule

m2-assistant[bot] commented 3 years ago

Hi @dholidev. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


: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, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] commented 3 years ago

Hi @engcom-Alfa. 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:

engcom-Alfa commented 3 years ago

Hi @dholidev .

Looks like this issue related to MSI functionality. @sdzhepa Could you move this ticket to the Inventory repository? Thanks!

m2-assistant[bot] commented 3 years ago

Hi @dholidev. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


magneticeye commented 3 years ago

I have what appears to be the same problem.

Running Magento ver. 2.4.2 I am using MSI functionality

When I checkout using Pickup Instore option I get this error: Quote does not have pickup location defined. When I checkout using Paypal express and pickup instore I get this error: Quote does not have pickup location assigned.

Checked that the source is assigned correctly and pickup instore is active for that source and that there is stock for that source.

magneticeye commented 3 years ago

@dholidev How are you dealing with this problem? Are you running an older version of magento? Or maybe an extension for custom shipping methods? Or have you just removed this functionality until it is fixed?

ghost commented 3 years ago

@magneticeye all right. The customer uses Magento Commerce 2.4.2 and needs the "Pickup Store" feature.

The customer's option was to disable only the "Instant Purchase" on the product page and keep the feature of storing the credit card.

zandreifurnica commented 3 years ago

@magento give me 2.4.3-p1 instance

magento-deployment-service[bot] commented 3 years ago

Hi @zandreifurnica. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @zandreifurnica, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

zandreifurnica commented 3 years ago

@magento give me 2.4.3-p1 instance

magento-deployment-service[bot] commented 3 years ago

Hi @zandreifurnica. Thank you for your request. I'm working on Magento instance for you.

magento-deployment-service[bot] commented 3 years ago

Hi @zandreifurnica, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

atomixstar commented 3 years ago

Hello, any news related to this issue? We have similar problem.

main.CRITICAL: Placing an order with quote_id 3AxnMz1GsgP7B3RXdEjpcWBaCRbauow7 is failed: Quote does not have Pickup Location assigned. [] []

dbachmann commented 2 years ago

Any updates here? This error also occurs in the latest 2.4.4

magneticeye commented 2 years ago

@dbachmann I ended up getting an extension to cover this functionality, I couldn't wait for it to be fixed.

DylanBluescope commented 2 years ago

@magneticeye What plugin did you get to help?

usud85 commented 2 years ago

still having the same problem, is there any solution ?

craig-bartlett commented 2 years ago

In our case (2.4.4), I found once the pickup location was set and the user pressed next, an AJAX request was sent to rest/default/V1/carts/mine/shipping-information with a JSON payload including the pickup_location_code. However there were two versions of the extension attributes element:

Screenshot 2022-09-28 at 15 43 16

I tracked with with a debugger and found that in various places it was using the empty "extension_attributes" variation, such as in vendor/magento/module-inventory-in-store-pickup-quote/Plugin/Quote/AddressCollection/GetPickupLocationInformationPlugin.php rather than the populated "extensionAttributes" one.

I can see that the "extensionAttributes" variation is used in JS here https://github.com/magento/inventory/blob/develop/InventoryInStorePickupFrontend/view/frontend/web/js/model/pickup-address-converter.js#L22 and here https://github.com/magento/inventory/blob/develop/InventoryInStorePickupFrontend/view/frontend/web/js/view/store-pickup.js#L293.

I'm not sure why it differs between the PHP and JS - perhaps some 3rd party module? I've overridden the two JS files above in our theme and changed the element name to "extension_attributes". For example:

return address.extension_attributes['pickup_location_code'];

This is working for us so far but I have more testing to do to figure out the cause.

rafaelcalero commented 2 years ago

@craig-bartlett could you please be more specific about your solution? we are facing the same issue and I'm kind of stuck.

Thank you

craig-bartlett commented 2 years ago

@rafaelcalero Hi, I copied the two JS files mentioned above (pickup-address-converter.js and store-pickup.js) into my theme. I then changed the references to "extensionAttributes" in them to "extension_attributes". I had to do the same with new-customer-address.js. I'm still unsure what brought this about as I have since been moved off this issue.

rafaelcalero commented 2 years ago

In our case, it was a js from a 3rd party module that puts extension_attributes.additional_methods in the address, therefore we had the following information in the shipping-information AJAX call (rest/default/V1/carts/mine/shipping-information):

image

As @craig-bartlett said, in this case when Magento is going to validate the pickup address it does a shippingAddress->getExtensionAttributes(). If both exist in the JSON (extensionAttributes and extension_attributes), Magento will take extension_attributes and lose the extensionAttributes information.

Our solution was to search among the third-party modules for a .js containing "extension_attributes.additional_methods", override it and replace it with "extensionAttributes.additional_methods"

In our case, it is a problem with the third-party module, although a possible Magento solution would be to merge both elements in case both exist.

bbosWebServices commented 5 months ago

@rafaelcalero this was very helpful in helping me to figure out what my issue was. I did have one module using the wrong naming convention. I never would have found that without this post... so thanks!

anvanza commented 3 weeks ago

@rafaelcalero , Thanks for the pointer.

Whether is should be extension_attributes or extensionAttributes is unclear to me. The magento devdocs mention extension_attributes. https://developer.adobe.com/commerce/php/tutorials/frontend/custom-checkout/add-address-field/#step-2-add-a-js-mixin-to-modify-data-submission