Magento News

 

Invalid qty to invoice item “%s””, by changing the quantity in the invoice

While creating an invoice items programmatically I came across this problem where I could not add item quantity by using a set method for some reason.

I initially had

$item->setQty(11)
...;

But I kept getting an error stating that “Invalid qty to invoice item ”

After several trials, the solution that work is to not use the set method direct and use the generic setData as shown below.

$item->setData(array('qty' => 11))
...;

In fact I find this later method a more reliable approach and I will now to use it more often.

Any more ideas, please drop a line!

Invalid qty to invoice item “%s””, by changing the quantity in the invoice

Possibly Related Posts:


 

Leave a Reply