Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created July 7, 2017 10:20
Show Gist options
  • Save xlplugins/a445645028602defbb87004e05b8024c to your computer and use it in GitHub Desktop.
Save xlplugins/a445645028602defbb87004e05b8024c to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment