I'm using multi-step checkout process and I'm trying to display only the shipping method options on the second step. ( image ) https://i.sstatic.net/kGO8D.jpg
By the default the shipping methods are displayed in the checkout page which I'll split into 3 parts:
My current code returns an empty array and not sure what I'm doing wrong.
add_action( 'woocommerce_review_order_after_shipping', 'woo_shipping_test' );
function woo_shipping_test() {
$available_shipping = WC()->shipping->get_shipping_methods();
var_dump($available_shipping);
}
@Dajer
Thanks buddy. I solved my problem - just commenting here just in case someone needs it ( even if this is very much adjusted to the client needs ).
I've added these lines of code in Step 2 of the checkout process. Although if you click on any of the radio buttons, it gets unchecked in a few seconds but it's still working and processing the selected shipping method as it should. As for ( checked, unchecked ) bug, I applied a bit of CSS as some sort of workaround.
I guess maybe it's not the best solution but that's good enough for now.
<?php do_action( 'woocommerce_review_order_before_shipping' ); ?>
<?php WC()->cart->calculate_totals(); ?>
<?php wc_cart_totals_shipping_html(); ?>
<?php do_action( 'woocommerce_review_order_after_shipping' ); ?>