1

How to add a product to cart, like a guest customer, without the need to have a registered product?

I created a module that have some informations about products that will be added to the shopping cart by api:

{
  "products" : [
    {
      "name" : "product1",
      "price" : 30.20,
      "qty" : 1
    },
    {
      "name" : "product2",
      "price" : 20.30,
      "qty" : 2
    }
  ]
}

But this products is not registered in Magento database. And I don't have the interest to register it. I only need to use the informations about these products to finish the checkout.

I need to know if someone knows how to add a "not registered" product to cart to magento make the collection with this "mocked" product and not search a product in the database.

Douglas Ianitsky
  • 1,028
  • 1
  • 7
  • 18
  • Please check the link it may help you click here – Magento Dev Aug 20 '18 at 06:55
  • @CharulTyagi This link don't help me, because to add the product to cart it need to exists (registered in database). I need to add a product not registered and I don't want to register the product. This is the same as what happens with the guest customer. But for product. – Douglas Ianitsky Aug 20 '18 at 16:20

0 Answers0