在我的woocommerce商店,我有一个支付网关插件,使用wordpress页面上的自定义结帐(ID 3334) . 这个wordpresspage使用我的自定义模板来获取 Headers (动作挂钩)和一些背景图像 .

一旦订单被放入结账,客户就会被转回同一页面(标识3334),然后显示感谢信息 .

我想打印每个步骤的 Headers ,即结账和订单确认,但我找不到如何检查订单是否放置而不是在结账阶段 . 标准的woocommerce我可以使用(is_order_received_page()),但是对于网关,我总是在同一页面上用于结账和感谢页面 .

尝试使用这些(在functions.php中的代码)付款后检查并挂钩我的自定义模板:

function headers ($order_id) { ?>
    <?php if (is_page('3334')) :
        $order = new WC_Order( $order_id );
        if ( $order->get_status() == 'processing' ):?>

        some html with the title and breadcrumbs

        <?php endif; endif; ?>}

以及:

function headers ($order_id) { ?>
<?php if (is_page('3334')) :
if ( $order_id->has_status('processing') ) :?>

some html with the title and breadcrumbs

<?php endif; endif; ?>}

function headers ($order_id) { ?>
<?php if (is_page('3334')) :

$order = wc_get_order( $order_id );

if( $order->get_status() == 'processing' ):?>

some html with the title and breadcrumbs

<?php endif; endif; ?>}

没有任何条件可行 .

对任何帮助都很有帮助 . 谢谢 .