Woocommerce Multiple Checkout Pages

2019-05-25 04:01发布


rSo I have been banging my head against my computer trying to figure out how to get this to work and am wondering if this is possible (well anything is possible with a bit of work).

My end goal is to have more than one page that holds the Woocommerce checkout form so that I can have a page for a custom one-page subscription checkout.

This works fine when I set the checkout form to be this page via the settings panel but if not set to this page it will not load the form with the proper scripts and is unable to perform ajax requests to update shipping etc, thus being restrictive to one page per working checkout form.

Steps taken:

So far I have tried bringing the form using the following :

  1. <?php echo do_shortcode('[woocommerce_checkout]'); ?>
  2. Through the Page's WYSIWYG (not a solution in my case eithey way)
  3. And Manually building the form via the provided functions

    <div class="checkout">
    <div class="col2-set" id="customer_details">
        <div class="col-1">
             <?php echo $woocommerce->checkout->checkout_form_shipping() ?>
        <div class="col-2">
            <?php echo $woocommerce->checkout->checkout_form_billing()?>
    <h3 id="order_review_heading">Your order</h3>
    <div id="order_review" style="zoom: 1; position: relative;">
        <?php echo wc_get_template( "checkout/review-order.php", array( "checkout" => WC()->checkout() ) ) ?>

All of these steps brought in the form but with the script/ajax errors. Please if anyone has accomplished this in the past I would love to hear what it takes. Suggestions are always welcome too! Thanks in advanced :)


I had the same problem, I fixed it by using this at the top of my custom checkout page:

if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) {
    define( 'WOOCOMMERCE_CHECKOUT', true );