Using the [woocommerce_checkout] shortcode (do_shortcode('[woocommerce_checkout]') in my Ajax-loaded PHP code) I can display the checkout form wherever I want. But payment methods are missing. How can I have these too?
If you are not calling the ajax from cart or checkout page you need to set WOOCOMMERCE_CHECKOUT = true before calling shortcode;
define( 'WOOCOMMERCE_CHECKOUT', true );
echo do_shortcode('[woocommerce_checkout]');
I think this is a bug.
I've reviewed the code and found out that <?php do_action( 'woocommerce_checkout_order_review' ); ?> on form-checkout.php is not able to run the hook add_action( 'woocommerce_checkout_order_review', 'woocommerce_checkout_payment', 20 ); if using shortcode [woocommerce_checkout].
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With