php 允许畅销商徽章显示不处理订单的静态文本徽章。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 允许畅销商徽章显示不处理订单的静态文本徽章。相关的知识,希望对你有一定的参考价值。

<?php 

/**
** Allow Best seller badge to show wihout processing orders
**/
add_filter('wcst_show_static_best_seller_badge', 'wcst_static_best_seller_badge',10,3);

/**
 * Hooked intp 'wcst_show_static_best_seller_badge'
 * Decide whether to show static content or not by checking merge tagv precense in the content
 * @param $bool Current State 
 * @param $single Array Single Trigger Data
 * @param $pro WC_Product Current Product In Process
 * @return bool modified or same boolean value
 */
function wcst_static_best_seller_badge($bool, $single,$pro) {


    if($single["label"] && strpos($single["label"],"{{rank}}") === false) {

        return true;
    }
    return $bool;
}

以上是关于php 允许畅销商徽章显示不处理订单的静态文本徽章。的主要内容,如果未能解决你的问题,请参考以下文章