我們正在使用 woocommerce 訂單跟蹤簡碼。這是我的 woocommerce 訂單跟蹤.php 文件。我們通過訂單 ID 和電子郵件跟蹤訪客用戶的訂單。我們可以在這里添加取消訂單按鈕,該按鈕可以取消訪客用戶的訂單嗎? <?php if ( $notes ) : ?> <h2><?php esc_html_e( 'Order updates', 'woocommerce' ); ?></h2> <ol class="commentlist notes"> <?php foreach ( $notes as $note ) : ?> <li class="comment note"> <div class="comment_container"> <div class="comment-text"> <p class="meta"><?php echo date_i18n( esc_html__( 'l jS \o\f F Y, h:ia', 'woocommerce' ), strtotime( $note->comment_date ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></p> <div class="description"> <?php echo wpautop( wptexturize( $note->comment_content ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> </div> <div class="clear"></div> </div> <div class="clear"></div> </div> </li> <?php endforeach; ?> </ol><?php endif; ?><?php do_action( 'woocommerce_view_order', $order->get_id() ); ?>這是訂單詳情頁面的視圖。在這里我想為訪客用戶添加取消訂單按鈕
1 回答

aluckdog
TA貢獻1847條經(jīng)驗 獲得超7個贊
使用 woocommerce
wc_get_account_orders_actions()
函數(shù)獲取所有 woocommerce 操作。在您的tracking.php 文件中添加以下鏈接即可
echo '<a href="'.$string.'" id="custom-cancel" class="woocommerce-button button' . sanitize_html_class( $key ) . '" >' .esc_html( $actions['cancel']['name'] ). '</a>';
- 1 回答
- 0 關注
- 125 瀏覽
添加回答
舉報
0/150
提交
取消