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
1 Answer 1
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();