1

I get quote id from below code it returns 6 as my quote id

$id=$this->_checkoutSession->getQuoteId();

I used the quote_id=6 in REST api like rest/default/V1/guest-carts/6/estimate-shipping-methods

It throws the below error in Postman

{ "message": "No such entity with %fieldName = %fieldValue", "parameters": { "fieldName": "cartId", "fieldValue": 0 } }

I have checked frontend cart page actual cart id seems encrypted rest/default/V1/guest-carts/6vf0uVP3A3RNBbTDPe4ECKxjDrJw44lO/estimate-shipping-methods

could you please anyone enlighten me? Thanks.

syntax

rest/default/V1/guest-carts/:cartId/estimate-shipping-methods

asked Feb 14, 2019 at 15:03

1 Answer 1

0

In the checkout session you can able to find the masked quote in js itself.

window.checkoutConfig.quoteData.entity_id for guest user.

For Examle

if window.checkoutConfig.quoteData.entity_id is digit means

 `customer is logged in` 

else

 `guest session` there you can find the masked quote id

For generating the Masked Quote id

inject the \Magento\Quote\Model\QuoteIdMaskFactory

$quoteIdMask = $this->quoteIdMaskFactory->create()->load(YOUR_QUOTE_ID, 'quote_id'); $id = $quoteIdMask->getMaskedId();

answered Dec 3, 2019 at 20:20

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.