• Resolved emilkos

    (@emilkos-1)


    Hi,
    I use the module for calculating delivery by local carrier,but the module do not calculate shipping costs to the total.
    In the “wp-content / plugins / woocommerce / templates / order / order-details.php” 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 “Econt_Customer_Shipping_Cost”, but not from “Order_subtotal” to get the total.
    Please if someone can tell me what to use to get a subtotal.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    Sorry I have no idea what you’re trying to do here. WC Core does not use “Econt_Customer_Shipping_Cost” – shipping costs are stored in the cart object.

    Thread Starter emilkos

    (@emilkos-1)

    Hi
    I use a plugin for delivery by a local courier “Econt Express”.
    Plugin considered shipping costs in real time, based on the weight of the product.
    Delivery cost is taken from the database of Econt Express.
    For this reason in chekout page the module of Econt Express adds a new field with the cost of delivery.
    You can test it here: https://www.parallelreality-bg.com/bookshop/?page_id=6
    I hid the fields Total and subtotal because I don’t need them in this case.
    The idea of the code above is to take the cost of shipping and the subtotal and sum them in Order page.
    Through this code I can take the cost of delivery, but I can’t take the subtotal.
    If necessary, I can provide the module for testing.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    I can’t support custom code/plugins here as this forum is for WC core only, however, I must say, if the shipping method is coded correctly to our spec (https://github.com/woothemes/woocommerce/wiki/Shipping-Method-API-(2.6)) this custom field is not needed. Rates are shown in the cart totals where the user selects a method…

    Thread Starter emilkos

    (@emilkos-1)

    Ok, thanks for the reply.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get value from cart total or subtotal’ is closed to new replies.