D
D
denism3002020-02-17 16:08:42
WordPress
denism300, 2020-02-17 16:08:42

How do I update the shipping cost on the checkout page?

I am customizing the checkout page, adding a block where, as planned, the cost of the selected delivery should be displayed.
It looks like this:

<div class="subtotal-form__shipping">
    <span class="subtotal-form__shipping-label">Доставка: </span>
    <span class="subtotal-form__shipping-price">
        <?php if (WC()->cart->get_shipping_total() && WC()->cart->get_shipping_total() > 0) :
            echo WC()->cart->get_shipping_total(); ?>
            <span class="woocommerce-Price-currencySymbol">
                <?php echo get_woocommerce_currency_symbol(); ?>
            </span>
        <?php else :
            echo 'бесплатно';
        endif; ?>
    </span>
</div>


how to update the field when changing the shipping method without reloading the page?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DooX, 2020-02-17
@DooX

Without reloading, this means using ajax or rest api wp.
and see the link

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question