In the minicart menu on my woocommerce site I’ve got it showing the products in the users cart, the total and the checkout button. I would also like the menu to show the subtotal and the delivery cost.
The code to display the total is:
<p class="total"><strong><?php _e( 'Total', 'woocommerce' ); ?>:</strong> <?php echo WC()->cart->get_cart_total(); ?></p>
Does anyone know how I can add the subtotal and the delivery (shipping) using woocommerce shortcodes? I’ve tried
<p class="shipping"><strong><?php _e( 'Shipping', 'woocommerce' ); ?>:</strong> <?php echo WC()->cart->get_cart_shipping(); ?></p>
But that doesn’t actually work.
Thank you in advance for any suggestions or answers!
You can display the subtotal with the code
But it will show the same price total as the call for the Total because the cost of shipping/delivery is natively calculated on the checkout page. Reason why you cannot display the delivery/shipping cost.
You can use this:
Reference here.