klub4lapy

Обратный звонок
Обратный звонок
Форма обратного звонка WordPress
/* * Добавляем часть формы к фрагменту */ add_filter( 'woocommerce_update_order_review_fragments', 'awoohc_add_update_form_billing', 99 ); function awoohc_add_update_form_billing( $fragments ) { $checkout = WC()->checkout(); ob_start(); ?>
Оплата и доставка
get_checkout_fields( 'billing' ); foreach ( $fields as $key => $field ) { if ( isset( $field['country_field'], $fields[ $field['country_field'] ] ) ) { $field['country'] = $checkout->get_value( $field['country_field'] ); } woocommerce_form_field( $key, $field, $checkout->get_value( $key ) ); } ?>
session->get( 'chosen_shipping_methods' ); if ( 'free_shipping:6' === $chosen_methods[0] ) { //Бесплатная доставка unset( $fields['billing']['billing_pickup_location'] ); unset( $fields['billing']['billing_city'] ); unset( $fields['billing']['billing_state'] ); unset( $fields['billing']['billing_postcode'] ); unset( $fields['billing']['billing_np'] ); } elseif ( 'free_shipping:7' === $chosen_methods[0] ) {//Самовывоз unset( $fields['billing']['billing_address_1'] ); unset( $fields['billing']['billing_city'] ); unset( $fields['billing']['billing_state'] ); unset( $fields['billing']['billing_postcode'] ); unset( $fields['billing']['billing_np'] ); } elseif ( 'free_shipping:8' === $chosen_methods[0] ) {//Укрпочта unset( $fields['billing']['billing_pickup_location'] ); unset( $fields['billing']['billing_pickup_location'] ); unset( $fields['billing']['billing_np'] ); } else { unset( $fields['billing']['billing_postcode'] ); unset( $fields['billing']['billing_pickup_location'] ); unset( $fields['billing']['billing_address_1'] ); } return $fields; } /* * Обновление формы */ add_action( 'wp_footer', 'awoohc_add_script_update_shipping_method',999 ); function awoohc_add_script_update_shipping_method() { if ( is_checkout() ) { ?>
Все результаты поиска