Wie kann ich die Zeilensumme für die Erstellung von Bestellung in Woo Commerce berechnen, wenn ich Gutscheincode von 20 rs off und und eine Steuer von 6% verwende.So berechnen Sie Zeilensumme in Wocommerce
$order = new WC_Order();
$order = wc_create_order($order_data);
$items = WC()->cart->get_cart();
foreach($items as $item => $values) {
$product_id = $values['product_id'];
$product = wc_get_product($product_id);
$quantity = (int)$values['quantity'];
$sale_price = $product->get_price();
$final_price = ?????
$price_params = array('totals' => array('subtotal' => $sale_price, 'total' => $final_price));
$order->add_product($product, $quantity,$price_params);
}
Hier, wie bekomme ich $ final_price ??
Mit WC_Cart :: calculate_totals(); –