de

  • Placeholder
  • // In your theme’s functions.php or via a snippet plugin /** * Shortcode to output only cart totals */ function ptp_cart_totals_summary() { // Only run this on the WooCommerce cart page if (!is_cart()) { return ''; } if (!WC()->cart) { return ''; } if (WC()->cart->is_empty()) { return '

    Your cart is currently empty.

    '; } ob_start(); echo '
    '; // Subtotal (before discounts, shipping, etc.) $subtotal = WC()->cart->get_subtotal(); echo '

    Subtotal: ' . wc_price($subtotal) . '

    '; // Cart total (with discounts, taxes, etc.) $total = WC()->cart->get_total('edit'); echo '

    Total: ' . wc_price($total) . '

    '; echo '
    '; return ob_get_clean(); } add_shortcode('ptp_cart_totals', 'ptp_cart_totals_summary');
  • Placeholder
1
    1
    Your Cart
    Scroll to Top