E. Kostadinov E. Kostadinov - 3 months ago 35x
PHP Question

WooCommerce get subtotal value from cart

I use the module for calculating delivery by local carrier, but the module do not calculate shipping costs to the total.
In the

I added the following code to take the amount of shipping and subtotal:

<? php $ a = array (
get_post_meta ($ order_id, 'Order_subtotal', true),
get_post_meta ($ order_id, 'Econt_Customer_Shipping_Cost', true));
<tr class = "total-cost">
<th> <? php _e ( 'Total:', 'woocommerce'); ?> </ Th>
<Td> <? php echo array_sum ($ a); ?> <? php echo
get_woocommerce_currency_symbol (); ?> </ td>
</ tr>

As a result, I get only the value of
, but not from
to get the total.
Please if someone can tell me what to use to get a subtotal.


Try this code $order_total = get_post_meta ($order_id , '_order_total', true);