Woocommerce多个结帐页面 [英] Woocommerce Multiple Checkout Pages

查看:53
本文介绍了Woocommerce多个结帐页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

r所以我一直把头撞在我的电脑上,试图弄清楚如何使它工作,并想知道这是否可能(一点点工作就能实现).

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

我的最终目标是拥有一个以上的页面,其中包含Woocommerce结帐表单,这样我就可以为自定义的一页订阅结帐创建一个页面.

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.

当我通过设置面板将结帐表单设置为此页面时,此方法工作正常,但如果未设置为此页面,它将无法使用适当的脚本加载该表单,并且无法执行ajax请求来更新运输等信息,因此每个工作结帐表格的页数限制为一页.

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.

已采取的步骤:

到目前为止,我已经尝试过使用以下表单:

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

  1. <?php echo do_shortcode('[woocommerce_checkout]');?>
  2. 通过Page的WYSIWYG(不是我的情况下的解决方案)
  3. 并通过提供的功能手动构建表单

  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>  
    <div class="col-2">
        <?php echo $woocommerce->checkout->checkout_form_billing()?>
    </div>
</div>  
<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() ) ) ?>
</div>

所有这些步骤都包含在表单中,但带有脚本/ajax错误.如果有人过去曾经做到这一点,请告诉我它需要什么.总是欢迎提出建议!在此先感谢:)

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 );
}

这篇关于Woocommerce多个结帐页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆