4

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?
0

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/...
  • I am not sure if this answers my question. So does this mean you have to use store-code in the API url to add-to-cart in that store? What if I add to cart to any store and later update the quote's store_id to the required one? If so which web-service needs to be used to update the quote's store id? – MagePsycho Aug 31 '16 at 7:25
  • Yes, you need to use store code consistently. If you omit store code Magento 2 assumes you're referring to the default store code. – Chuck Mar 24 '17 at 16:17

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.