簡體   English   中英

隱藏WooCommerce感謝您的頁面訂單詳情

[英]Hide WooCommerce thank you page order details

在我的WooCommerce商店下訂單后,客戶被重定向到感謝(訂單收到)頁面。

我想隱藏WooCommerce在該頁面上生成的所有細節,以便它只顯示我在頁面頂部顯示的自定義內容。

我嘗試過使用一些自定義CSS display:none; 但是沒有任何合適的選擇器可供選擇。

我該如何隱藏:

  1. 訂單詳細信息
  2. 顧客信息
  3. 帳單地址
  4. 訂單號
  5. 日期
  6. 付款方法

在此輸入圖像描述

它可以通過多種方式完成,其中一種方法是使用WooCommerce模板覆蓋

復制此文件

/wp-content/plugins/woocommerce/templates/checkout/thankyou.php

並將其粘貼到您的活動主題目錄中

/wp-content/themes/activetheme/woocommerce/checkout/thankyou.php

並刪除此

<ul class="woocommerce-thankyou-order-details order_details">
    <li class="order">
        <?php _e( 'Order Number:', 'woocommerce' ); ?>
        <strong><?php echo $order->get_order_number(); ?></strong>
    </li>
    <li class="date">
        <?php _e( 'Date:', 'woocommerce' ); ?>
        <strong><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></strong>
    </li>
    <li class="total">
        <?php _e( 'Total:', 'woocommerce' ); ?>
        <strong><?php echo $order->get_formatted_order_total(); ?></strong>
    </li>
    <?php if ( $order->payment_method_title ) : ?>
    <li class="method">
        <?php _e( 'Payment Method:', 'woocommerce' ); ?>
        <strong><?php echo $order->payment_method_title; ?></strong>
    </li>
    <?php endif; ?>
</ul>
<div class="clear"></div>

並刪除此

<?php do_action( 'woocommerce_thankyou_' . $order->payment_method, $order->id ); ?>
<?php do_action( 'woocommerce_thankyou', $order->id ); ?>

所以你的最終thankyou.php看起來像這樣。

if (!defined('ABSPATH'))
{
    exit;
}
if ($order) :
    ?>
    <?php if ($order->has_status('failed')) : ?>
        <p class="woocommerce-thankyou-order-failed"><?php _e('Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again.', 'woocommerce'); ?></p>
        <p class="woocommerce-thankyou-order-failed-actions">
            <a href="<?php echo esc_url($order->get_checkout_payment_url()); ?>" class="button pay"><?php _e('Pay', 'woocommerce') ?></a>
            <?php if (is_user_logged_in()) : ?>
                <a href="<?php echo esc_url(wc_get_page_permalink('myaccount')); ?>" class="button pay"><?php _e('My Account', 'woocommerce'); ?></a>
            <?php endif; ?>
        </p>
    <?php else : ?>
        <p class="woocommerce-thankyou-order-received"><?php echo apply_filters('woocommerce_thankyou_order_received_text', __('Thank you. Your order has been received.', 'woocommerce'), $order); ?></p>
    <?php endif; ?>
<?php else : ?>
    <p class="woocommerce-thankyou-order-received"><?php echo apply_filters('woocommerce_thankyou_order_received_text', __('Thank you. Your order has been received.', 'woocommerce'), null); ?></p>
<?php endif; ?>

希望這可以幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM