0

The shop is working on a magento 2.3 with MSI.

I would like to add two informations to each item in a guest cart endpoint /V1/guest-carts/:cartId.

  • The stock from a given source
  • A thumbnail from a product custom attribute

What is the best way to achieve this ?

I had try to use extension attribute, but not successfully.

0

When you work on front-end, the system knows nothing about sources and their number assigned to the given stock/website. So, when you work with a shopping cart, you have a scope of Magento website you are working with, by that website you can resolve a Stock assigned to your website (\Magento\InventorySalesApi\Model\StockByWebsiteIdResolverInterface::execute), and from that Stock, you can retrieve product quantity using service - https://github.com/magento-engcom/msi/blob/2.3-develop/app/code/Magento/InventorySalesApi/Api/GetProductSalableQtyInterface.php

| improve this answer | |
0

A source can be assigned during a shipment creation process only. On the front-end, a stock is assigned instead based on a website. As an example of tweaking Advanced MSI from eComBricks can be checked.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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