Skip to content
Michel
1 article published
Go to Top
get_total());
$currency = esc_js($order->get_currency());
$txn = esc_js($order->get_order_number());
$items_arr = [];
foreach ($order->get_items() as $item) {
$p = $item->get_product();
$sku = $p ? ($p->get_sku() ?: (string)$p->get_id()) : (string)$item->get_product_id();
$qty = (int)$item->get_quantity();
$price = round($item->get_total() / max(1, $qty), 2);
$items_arr[] = json_encode(['item_id' => $sku, 'item_name' => $item->get_name(), 'price' => $price, 'quantity' => $qty]);
}
$items_json = implode(',', $items_arr);
?>