Magento – Magento2 SOAP API for multi-store

magento2quotesoapweb services

Background:

I am planning to use Magento2 web-service using SOAP. This will be for Mobile App where customer are allowed to add to cart then checkout.
The store will be a multi-store website where the customer can easily change the store of their choice.

Question:

To initialize quote / empty cart, we can use web-service:
http://magento210.dev/soap/?services=quoteGuestCartRepositoryV1

but this doesn't have storeId as an input request (unlike Magento1)

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:def="http://magento210.dev/soap/default?services=quoteGuestCartManagementV1">
   <soap:Header/>
   <soap:Body>
      <def:quoteGuestCartManagementV1CreateEmptyCartRequest/>
   </soap:Body>
</soap:Envelope>

Since website will be multi-store one, store_id of quote needs to be updated as they switch the store. The following questions remain unanswered for me:

  • How will we update the store_id of a quote?
  • OR How can we add to cart as per store?

Best Answer

See our dev docs page for SOAP. Works the same in REST to. the store code is an optional URL parameter, we assume 'default' store code.

So for API's baseurl let's Magento know which website the API impacts.

Store code is part of the API's url, it's optional and we assume default There's a special store code 'all' so catalog operations work just like using the admin panel GUI (extensible object to define which store views that product shows up in) or you can do individual catalog calls per store view (if you're doing different languages in each store view/etc).

  • Soap: http:///soap/...
  • Rest: http:///rest/...
Related Topic