[英]Display text after order is placed woocommerce
在我的 woocommerce 訂單下達后,我試圖顯示一些文本。
我有以下一段代碼,但它似乎不起作用。 可能是什么問題?
add_action('woocommerce_thankyou', 'simplicate_send', 10, 1);
function simplicate_send($order_id){
echo 'hello';
}
請在函數中嘗試以下代碼。php
add_action( 'woocommerce_thankyou', 'bbloomer_redirectcustom',10,1);
function bbloomer_redirectcustom( $order_id ){
$order = wc_get_order( $order_id );
//whatever you dispaly text here
// echo "hello";
$url = 'http://localhost/html/wordpress3/?page_id=501'; // redirect thank you page
if ( ! $order->has_status( 'failed' ) ) {
wp_safe_redirect( $url );
exit;
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.