Print the chosen Shipping Method at Checkout Page
-
Hi,
I am testing the code below at Checkout Page:
==============================================================
add_action( ‘woocommerce_after_checkout_form’, ‘disable_shipping_local_pickup’ );
function disable_shipping_local_pickup( $available_gateways ) {
$chosen_methods = WC()->session->get( ‘chosen_shipping_methods’ );
$chosen_shipping = $chosen_methods[0];
echo “<br>line1<br>”;
echo WC()->session->get( ‘chosen_shipping_methods’ );
echo “<br>line2<br>”;
echo $chosen_methods[0];
echo “<br>line3<br>”;
==============================================================When choose a Shipping Method at Cart Page and press Checkout button, I hope can print the chosen Shipping Method at Checkout Page. So, I use “echo $chosen_methods[0];” at my code above. However, I get the blank result. The result show like this:
==============================================================
line1
Array
line2line3
==============================================================Why this happen? Do you know what is the possible problem or what wrong I do? Thank you very much for the replies.
- The topic ‘Print the chosen Shipping Method at Checkout Page’ is closed to new replies.