• Resolved yewbeng0104

    (@yewbeng0104)


    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
    line2

    line3
    ==============================================================

    Why this happen? Do you know what is the possible problem or what wrong I do? Thank you very much for the replies.

    • This topic was modified 3 years, 9 months ago by yewbeng0104.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Print the chosen Shipping Method at Checkout Page’ is closed to new replies.