【发布时间】:2020-07-31 01:44:30
【问题描述】:
我编写了一些代码,用于在基于产品类别的产品详细信息页面上显示自定义延期交货消息。
function custom_backorder_message( $text, $product ){
if ( $product->managing_stock() && $product->is_on_backorder( 1 ) ) {
if( has_term( 'bridal-line', 'product_cat' ) ) {
$text = __( 'Your piece will be handcrafted for you. Upon order we will manufacture your piece of eternity. Sadly, we can not give you a timeline, due to Covid 19, but are expecting 5-7 weeks', 'text-domain' );
}else {
$text = __( 'This product is currently out of stock, but upon order we will handcraft your piece. Sadly, we can not give you a timeline, due to Covid 19, but are expecting 6-8 week.', 'text-domain' );
}
}
return $text;
}
add_filter( 'woocommerce_get_availability_text', 'custom_backorder_message', 10, 2 );
现在,在购物车页面上显示“可延期交货”。如何在此处显示正确的延期交货消息?
感谢任何帮助!
【问题讨论】:
标签: php wordpress woocommerce hook-woocommerce taxonomy-terms