kmaroff
11/8/2019 - 8:42 AM

Перенос блока с выбором доставки и правильный ajax запрос на обновление

<?php if ( WC()->cart->needs_shipping() && WC()->cart->show_shipping() ) : ?>
                    
    <?php do_action( 'woocommerce_review_order_before_shipping' ); ?>

        <table class="my-custom-shipping-table"><!-- Our table -->
            <tbody>
             <?php wc_cart_totals_shipping_html(); ?>
            </tbody>
        </table>

    <?php do_action( 'woocommerce_review_order_after_shipping' ); ?>

<?php endif; ?>
<?php
add_filter( 'woocommerce_update_order_review_fragments', 'my_custom_shipping_table_update');
function my_custom_shipping_table_update( $fragments ) {
    
     
    ob_start();
    ?>
    <table class="my-custom-shipping-table">
        <tbody>

        <?php wc_cart_totals_shipping_html(); ?>
        </tbody>
    </table>
    <?php
    $woocommerce_shipping_methods = ob_get_clean();
    $fragments['.my-custom-shipping-table'] = $woocommerce_shipping_methods;
    
    return $fragments;
}