Teşekkürler cevabınız için. Daha da açayım sorumu, anlaşılır olması açısından.
Kodumuz bu.
// create a new purchase bill
$purchase = $muhasebe->make('sale')->create([
'description' => $siparis,
'invoice_id' => null,
'invoice_series' => null,
'currency' => 'TRL',
'item_type' => 'invoice',
'issue_date' => $order_date_created,
'due_date' => $order_date_created,
'contact_id' => $contactToken,
'category_id' => null,
'archived' => false,
'billing_address' => $user_address,
'billing_fax' => null,
'billing_phone' => $user_phone,
'details_attributes' => [
[
'product_id' => '5542003', // the products
'quantity' => '3',
'unit_price' => '11.29',
'vat_rate' => '18',
'discount_type' => 'amount',
'discount_value' => '0',
],
[
'product_id' => '5542004', // the products
'quantity' => '2',
'unit_price' => '15.29',
'vat_rate' => '18',
'discount_type' => 'amount',
'discount_value' => '0',
],
],
]);Yukarıdaki kodda yer alan details_attributes içinde kaç adet ürün varsa onların detayları sıra ile yer alması gerekiyor.
foreach ($order->get_items() as $item_key => $item) {
$item_data = $item->get_data();
$product = $order->get_product_from_item($item);
$sku[] = $parasut->make('product')->getProduct($product->get_sku());
$qty[] = $item->get_quantity();
$total[] = $order->get_item_meta($item_key, '_line_total', true);
}Bu kod ile siparişte yer alan ürünleri çekiyorum ama ilk kodun içine yazdıramıyorum. İlk mesajımda da belirttiğim gibi php bilgim çok olmadığı için yanlış belirtmiş de olabilirim. Okumadığım Türkçe/İngilizce makale kalmadı ama bir türlü beceremedim.
Teşekkürler şimdiden.