Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WooCommerce : [woocommerce_checkout] shortcode displays checkout form but not payment methods

Tags:

woocommerce

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?

like image 933
drake035 Avatar asked Dec 15 '15 09:12

drake035


2 Answers

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]');
like image 147
Swarnendu Paul Avatar answered Oct 23 '22 03:10

Swarnendu Paul


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].

like image 20
Reigel Avatar answered Oct 23 '22 05:10

Reigel