Skip to content

Commit 8f7fe62

Browse files
committed
Improved sale badge
1 parent 14395ab commit 8f7fe62

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

assets/scss/_bootscore-woocommerce.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
@import "bootscore-woocommerce/wc-product-grouped";
2323
@import "bootscore-woocommerce/wc-product-variable";
2424
@import "bootscore-woocommerce/wc-deprecated";
25-
@import "bootscore-woocommerce/wc-sale-badge";
2625
@import "bootscore-woocommerce/wc-shipping";
2726
@import "bootscore-woocommerce/wc-shop-page";
2827
@import "bootscore-woocommerce/wc-tables";

assets/scss/bootscore-woocommerce/_wc-sale-badge.scss

Lines changed: 0 additions & 12 deletions
This file was deleted.

woocommerce/inc/wc-sale-flash.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/**
4+
* WooCommerce Sale Flash
5+
*
6+
* @package Bootscore
7+
* @version 6.3.0
8+
*/
9+
10+
11+
// Exit if accessed directly
12+
defined('ABSPATH') || exit;
13+
14+
15+
/**
16+
* Sale Badge in loop and single-product page
17+
*/
18+
add_filter('woocommerce_sale_flash', function($html, $post, $product) {
19+
// Use Bootstrap 5 badge class instead of WooCommerce default
20+
return '<span class="badge text-bg-danger position-absolute top-0 atart-0 mt-3 ms-3 z-1">' . esc_html__('Sale!', 'woocommerce') . '</span>';
21+
}, 10, 3);
22+

woocommerce/wc-functions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* WooCommerce functions and definitions
55
*
66
* @package Bootscore
7-
* @version 6.2.0
7+
* @version 6.3.0
88
*/
99

1010

@@ -23,6 +23,7 @@
2323
require_once('inc/wc-qty-btn.php');
2424
require_once('inc/wc-redirects.php');
2525
require_once('inc/wc-result-count.php');
26+
require_once('inc/wc-sale-flash.php');
2627
require_once('inc/wc-setup.php');
2728
require_once('inc/wc-single-product-reviews.php');
2829
require_once('inc/wc-tabs.php');

0 commit comments

Comments
 (0)