I am using Magento2 and need to add a product to the cart from a remote site. Same TLD, different subdomain.
www.mainsite.com add to
I was using the REST API and found that it actually uses sessions, which override other data when adding to a cart.
For example POST to
/rest/V1/guest-carts will return a
cartID and set the PHPSESSID cookie. If you include the
PHPSESSID in subsequent POST to
/rest/V1/guest-carts/cartID/items then the
cartID is overridden and
PHPSESSID is used instead.
It seems like the cart data is now tied to
PHPSESSID, but if I go to
checkout.mainsite.com there is nothing in the shopping cart, even though my
PHPSESSID is still the same.
Can the API be used as is to AddToCart from a remote site, then go to Magento2 and view the items in the cart?