0

I have upgraded the Magento version to 2.3.7. After that, I have a strange issue on the checkout page that when it calls the ajax function the URL is been wrongly generated. Previously it was like

<website>/rest/default/V1/guest-carts/AC72N37Vmo3uGMIXEVQfIDt1ubuZLJws/estimate-shipping-methods

but after upgrading the Magento version now it's

<website>/checkout/undefinedrest/default/V1/guest-carts/AC72N37Vmo3uGMIXEVQfIDt1ubuZLJws/estimate-shipping-methods

Not sure from where this undefined gets added within the URL ??

Research Notes: -

The secure & unsecure base URL is correctly set up. I checked it again

Also, I navigated to the file from where this ajax call is generated, the file is

vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js

enter image description here

Here is the storage. post is from the ajax call is generated and it has service URL & payload as arguments.

in get Rates function - if we console.log "serviceUrl" then it shows the below URL

rest/default/V1/guest-carts/FsS4QvllSq1vpuxZuC8ycQa0VRMOcQCy/estimate-shipping-methods

which seem to be correct, storage.post() function takes this as an argument and ajax request is called which then gets into the .fail() function

so what I think is that the problem is where the front part of the URL gets added to it for making the ajax call that is http://sitename.local/checkout/undefined ---> and here somehow the undefined gets added which breaks the whole URL

The same issue is encountered by other users also but no solution is available yet.

undefined rest api checkout cart

https://community.magento.com/t5/Magento-2-x-Programming/Magento2-Wrong-base-url-on-ajax-call/td-p/435435

Can anyone help me out with this?

1 Answer 1

0

You can try the following ways.

  1. Take the entire checkout module from the same fresh magento version.

  2. Try to do the magento upgrade again with composer.

So if any mistake remain into upgrade can be resolve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.