API order creation fails in Magento

I get a rather strange error when trying to create a new order through Magento API V1.0. Here is the main workflow of my code:

  • Create a shopping cart using the cart.create method.
  • Set the client as a guest using the cart_customer.set method.
  • Add products to the cart using the cart_product.add method.
  • Create an order using the cart.order method.

At this point, the cart.order method throws a SoapFault exception with the message "Calling the member function setFinalPrice () for a non-object." The same exception occurs if I replace the cart.order method cart.order other methods, such as cart.info or cart_product.list .

Since the exception message doesn't seem very descriptive, I was wondering if anyone else had ever come across this.

Thanks.

UPDATE: The problem is that I add products to the cart using my SKUs when calling the cart_product.add method. An exception is no longer thrown when using product identifiers instead of SKUs (I suspect this might be a bug). However, at this point, the cart.order method returns false, so the order has not yet been created.

+8
api magento
source share
1 answer

Before you execute the cart.order method, you must assign a payment and delivery address to your basket.

This is the standard procedure for creating order in magento.

steps should be like this:

  • Create a shopping cart using the cart.create method.
  • Define the client as a guest using the cart_customer.set method.
  • Add products to the cart using the cart_product.add method.

try calling cart_shipping.method and cart_payment.method before you call cart.order

  • Create an order using the cart.order method.
+3
source share

All Articles