AI Verified

Name

Change sales badge text for specific product

About

Change the text of the sales badge on a specific product

Language

PHP

Rating

Voted: 0 by 0 user(s)

How to Setup Snippet

1. Make sure you have set a sales price on the product in question 2. Find the id of the product where you want to change the badge text and set that on line #3 3. Change the text on line #4 from Black Friday Sale! to whatever you want / need the default woocommerc text here is "Sale"

Codevault

George Snippet Library

Scroll down to see more snippets from this codevault.

Wordpress Compatability

The author has indicated that this snippet is compatable up to wordpress version: 6.1

Our AI bot has checked this snippet is compatable up to wordpress version: 6.1

Code Snippet Plugin Sync

Free & Pro

Download this snippet by clicking the download button, then head over to the Code Snippet Plugin settings in your wordpress admin dashboard, select the import menu then upload this file to import into your wordpress site.

Pro Only (Coming Soon)

You will be able to click a button and sync this snippet to your wordpress site automatically and from your dashboard manage all code snippets across all your wordpress sites that have the Code Snippets Pro plugin installed.

History

Last modified:

13/11/2022

Important Note

This snippet has the following status:

AI Verified

This snippet has been tested by our AI bot, see any comments below.

AI Bot Comments:

Found 0 vulnerabilities

Change sales badge text for specific product

 
                    
1function gncy_custom_sales_badge_text($text, $post, $_product) {
2 global $product;
3 if ( $product->get_id() == 1703 ) {
4 $html = '<span class="onsale">Black Friday Sale!</span>';
5 return $html;
6 }
7}
8 
9add_filter( 'woocommerce_sale_flash', 'gncy_custom_sales_badge_text', 10, 3);

0

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

WooCommerce Subscribe To Emails Checkbox On Checkout

Added: 1 year ago

Last Updated: 1 year ago

Asking users to subscribe to your emails on the checkout page is the perfect place to begin remarketing your store and products to advocates. A paying customer doesn’t need as much convincing to buy a...

WooCommerce

AI Verified

5

WooCommerce Show Number Of People Viewing Product

Added: 1 year ago

Last Updated: 1 year ago

We want to make this solution absolutely clear from the outset. This snippet does NOT generate the actual number of people viewing the product. It shows a randomly generated number in the range of two...

WooCommerce

AI Verified

0

Limit WooCommerce product title to a specific length

Added: 1 year ago

Last Updated: 1 year ago

Limit WooCommerce product title in the first line

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

5

Delete Woocommerce images after deleting product

Added: 1 year ago

Last Updated: 6 days ago

Automatically Delete WooCommerce Images After Deleting a Product. If you use the same image of multiple products the image will not be deleted for those

WooCommerce

AI Verified

1

Remove categories from the shop and other pages in Woocommerce

Added: 1 year ago

Last Updated: 1 year ago

Remove any categories from WooCommerce frontend

WooCommerce

AI Verified

1

Add Alphabetical Sorting to Woocommerce

Added: 1 year ago

Last Updated: 1 year ago

Sorts products alphabetically in Woocommerce