![](/img/trans.png)
[英]WooCommerce - Add information to “thank you” page by function hooked in shipping method
[英]WooCommerce - Add content on the thank you page by the shipping method
可能是您將shortcode
添加到thank you
文本的方式可能是問題所在。
請參閱以下我為演示創建的稱為avengers 的shortcode
函數。
function call_avangers( $atts ){
return "<p>Avengers . . . . Assemble !!!</p>";
}
add_shortcode( 'avengers', 'call_avangers' );
您可以使用以下功能在感謝頁面中顯示此短代碼
add_filter( 'woocommerce_thankyou_order_received_text', 'woo_change_order_received_text', 20, 2 );
function woo_change_order_received_text( $text, $order ) {
if( $order->get_shipping_method() == 'your_shipping_method_here' ) {
$text .= do_shortcode('[avengers]');
}
return $text;
}
基本的事情是你必須調用do_shortcode('your_shortcode_name')
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.