Created
July 7, 2017 10:20
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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