小编use*_*861的帖子

WooCommerce 根据产品类别替换购物车/结帐中的“延期交货可用”

我编写了一些代码,用于在基于产品类别的产品详细信息页面上显示自定义缺货消息。

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. …
Run Code Online (Sandbox Code Playgroud)

php wordpress woocommerce hook-woocommerce taxonomy-terms

5
推荐指数
1
解决办法
5430
查看次数