Answer the question
In order to leave comments, you need to log in
How to attach a couple of lines of text to the selected shipping method?
Hello.
my task. The appearance of a line of text (if it does change, then in the files), after choosing a delivery method.
For example: free_shipping:1 text appears: Free shipping only within the city where our store is located.
free_shipping:0 text appears: Shipping $2? only within the city where our store is located
Well, display this text to the client. In the class/field "notic-billing" I
planned to use the construction..
add_filter( 'woocommerce_checkout_fields', 'awoohc_override_checkout_fields' );
function awoohc_override_checkout_fields( $fields ) {
// получаем выбранные метод доставки
$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
// проверяем текущий метод и добавляем текст
if ( 'free_shipping:1' === $chosen_methods[0] ) {
set( $fields['billing']['notic-billing'] = "Вы заказываете бесплатную доставку в пределах досягаемости магазина филиала";
)
return $fields;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question