Fix - Sale badge issue for ridestyle theme (The 7up WordPress Team)
Fix the sale badge issue for the Ridestyle theme (by The 7up WordPress Team).
if (!function_exists('s7upf_product_label')) {
function s7upf_product_label($echo = true)
{
global $product, $post;
$date_pro = strtotime($post->post_date);
$date_now = strtotime('now');
$set_timer = s7upf_get_option('sv_set_time_woo', 30);
$uppsell = ($date_now - $date_pro - $set_timer * 24 * 60 * 60);
$html = '';
if ($product->is_on_sale() || $uppsell < 0) {
$html .= '<div class="product-label">';
}
if ($product->is_on_sale()) {
$from = $product->get_regular_price();
$to = $product->get_price();
if ($from) {
$percent = round(($from - $to) / $from * 100);
$html .= apply_filters('woocommerce_sale_flash', '<span class="sale">-' . esc_html($percent) . '%</span>', $post, $product);
}
}
if ($uppsell < 0) {
$html .= '<span class="new">' . esc_html__("New", "ridestyle") . '</span>';
}
if ($product->is_on_sale() || $uppsell < 0) {
$html .= '</div>';
}
if ($echo) {
echo apply_filters('s7upf_product_label', $html);
} else {
return apply_filters('s7upf_product_label', $html);
}
}
}PreviousDisable rules on API RequestNextFix - Sale badge issue compatibility for ridestyle theme (The 7up WordPress Team)
Last updated