Magento2: how to create a guest cart and open the checkout page with this cart so the user can to finish the purchase?

Viewed 28

In an web or mobile app, we build a list of items to be ordered from a Magento2 eComm website.
The plan is to programmatically create the cart in Magento2 and open the checkout page in the browser for the user to finish the purchase.

I managed so far to:

  1. Create a cart and get its id:
  1. Add items to cart by:
    "cartItem": {
        "sku": "-my-sku-",
        "qty": 3
    }
}

Received as answer json:

{
    "item_id": 22048,
    "sku": "-my-sku-",
    "qty": 3,
    "name": "... product name...",
    "price": 10.86,
    "product_type": "simple",
    "quote_id": "11212"
}

And that's it. I did not manage to open the checkout page with the cart-id that have the products in it.
I tried with: https://my-domain.com//checkout/?cartId=11212 (that is quote_id, also tried with item_id and the alphanumeric id). Nothing works.

How do I open the checkout page with the cart-id I received? so the products I added are in the cart?
Or is there another approach to achieve the desired result?


1 Answers
Related