Magento Programmatically Create Order

I just had to massively rework an interface to another shopping site for a customer. Therefore, I had to programmatically create orders in Magento, which is really an awful challenge. A pretty nice help for this was the code of Vinai Kopp, published under Pastebin.

A little extension for Vinai’s code: If you already have a customer object $customer and want to use the default billing and shipping address, you can set it like that (compare with line 42/43 of Vinai’s code):

$quote->getBillingAddress()->importCustomerAddress($customer->getPrimaryBillingAddress());
$quote->getShippingAddress()->importCustomerAddress($customer->getPrimaryShippingAddress());

Hope this helps someone 🙂

Ein Gedanke zu „Magento Programmatically Create Order“

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert