xlplugins
7/7/2017 - 10:20 AM

Allow Best Seller badge to Show Static Text Badge that do not process orders.

Allow Best Seller badge to Show Static Text Badge that do not process orders.

<?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;
}