Редактирую шаблон письма с информацией о заказе. Woocommerce выдает ошибку(она не отображается почему-то, просто error)если я хочу отправить заказ. Если удалить $item->get_price();
то все хорошо работает. Где я допускаю ошибку?
$order_id = $order->get_id(); // The order_id
// get an instance of the WC_Order object
$order = wc_get_order( $order_id );
// The loop to get the order items which are WC_Order_Item_Product objects since WC 3+
foreach( $order->get_items() as $item_id => $item ){
//Get the product ID
$product_id = $item->get_product_id();
//Get the variation ID
$product_id = $item->get_variation_id();
//Get the WC_Product object
$product = $item->get_product();
// The quantity
$product_count = $item->get_quantity();
$product_price = $item->get_price();
// The product name
$product_name = $item->get_name(); // … OR: $product->get_name();
//Get the product SKU (using WC_Product method)
$sku = $product->get_sku();
echo "<tr><td><p>".$product_name." ".$sku."</p></td>"."<td><p>".$product_count."</p></td>"."<td><p>".$product_price."</p></td>"."</tr>";
}