WC_AJAX::update_shipping_method()
AJAX update shipping method on cart page.
Метод класса: WC_AJAX{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WC_AJAX::update_shipping_method();
Код WC_AJAX::update_shipping_method() WC AJAX::update shipping method WC 9.2.3
public static function update_shipping_method() { check_ajax_referer( 'update-shipping-method', 'security' ); wc_maybe_define_constant( 'WOOCOMMERCE_CART', true ); $chosen_shipping_methods = WC()->session->get( 'chosen_shipping_methods' ); $posted_shipping_methods = isset( $_POST['shipping_method'] ) ? wc_clean( wp_unslash( $_POST['shipping_method'] ) ) : array(); if ( is_array( $posted_shipping_methods ) ) { foreach ( $posted_shipping_methods as $i => $value ) { if ( ! is_string( $value ) ) { continue; } $chosen_shipping_methods[ $i ] = $value; } } WC()->session->set( 'chosen_shipping_methods', $chosen_shipping_methods ); self::get_cart_totals(); }