我正在使用woocommerce處理我的wordpress 上的訂單,並且我正在使用自定義付款網關插件。一切工作完美,除了我想修改感謝頁面,告訴客戶訂單已成功註冊。 過程中支付功能:Woocommerce付款定製謝謝頁
public function process_payment($order_id) {
global $woocommerce;
$order = new WC_Order($order_id);
// Mark as on-hold (we're awaiting the cheque)
$order->update_status('on-hold', __('Awaiting payment', 'woocommerce-other-payment-gateway'));
// Reduce stock levels
$order->reduce_order_stock();
if(isset($_POST[ $this->id.'-admin-note']) && trim($_POST[ $this->id.'-admin-note'])!=''){
$order->add_order_note(esc_html($_POST[ $this->id.'-admin-note']),1);
}
// Remove cart
$woocommerce->cart->empty_cart();
// Return thankyou redirect
return array(
'result' => 'success',
'redirect' => $this->get_return_url($order)
);
}
我希望當用戶看到的感謝您網頁,他會後,系統會automaticaly重定向。
我不想改變像陣列上的重定向URL:
'redirect' => 'http://example.com/'
我想他看到頁面後重定向他,我怎麼能設法做到這一點?
在此先感謝。
首先你想顯示默認的感謝頁面,然後你想重定向用戶到你的自定義感謝頁面,對不對? –
@MahaDev正好 –
你爲什麼想這樣做?沒有他們的意見,重新引導人們似乎是不好的用戶體驗。你怎麼知道某人讀完了什麼? 爲什麼不創建自定義感謝頁面,或將自定義信息添加到現有的感謝頁面。 – helgatheviking