AI Verified

Name

Reduced prices: How long is the product reduced?

About

How long is the discounted price of one of your products valid? You can enter an offer price and an offer period for a product in WooCommerce. On the product page, however, only the offer price is displayed, but not the period of the offer price. With this WooCommerce snippet you can change that.

Language

PHP

Rating

Voted: 0 by 0 user(s)

Codevault

jbeer

Scroll down to see more snippets from this codevault.

Wordpress Compatability

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

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:

18/05/2023

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

Reduced prices: How long is the product reduced?

 
                    
1if (!function_exists( 'evolution_custom_price_html' ) ) :
2/**
3 * Angebotszeitraum beim Produkt anzeigen
4 */
5function evolution_custom_price_html( $price, $product ){
6 global $post;
7 $sales_price_to = get_post_meta($post->ID, '_sale_price_dates_to', true);
8 if(is_single() && $sales_price_to != "")
9 {
10 $sales_price_date_to = date("j M y", $sales_price_to);
11 // Umlaute stets maskieren - Siehe www.math.uni-hamburg.de/doc/html/selfhtml-6.1/tcad.htm
12 return str_replace( '</ins>', ' </ins> <b>(Angebot gültig bis: '.$sales_price_date_to.')</b>', $price );
13 }
14 else
15 {
16 return apply_filters( 'woocommerce_get_price', $price );
17 }
18}
19add_filter( 'woocommerce_get_price_html', 'evolution_custom_price_html', 100, 2 );
20endif;

0

Featured Snippet

Related Snippets

Please see some snippets below related to this snippet..

WooCommerce

AI Verified

0

0.00 TO FREE

Added: 9 months ago

Last Updated: 9 months ago

Make your price looks more professional by converting to text FREE instead of 0:00

WooCommerce

AI Verified

0

Remove WooCommerce Related Products

Added: 9 months ago

Last Updated: 9 months ago

WooCommerce

AI Verified

0

WooCommerce Custom Date Field On Registration Form

Added: 1 year ago

Last Updated: 1 year ago

This guide shows you how you can implement a custom date picker field on the My Account registration form in WooCoomerce and save the data as User Meta shown in User Profile Editor in the Dashboard. T...

Other Snippets in this Codevault

These are some popular snippets from this users codevault..

WooCommerce

AI Verified

3

Confirm Password Field in Woocommerce

Added: 2 years ago

Last Updated: 2 months ago

WooCommerce

AI Verified

3

Redirect customers to own thank-you page after order

Added: 2 years ago

Last Updated: 2 months ago

You may want to redirect your customers to a custom thank you page after they place an order. You can do that with the following WooCommerce snippet

WooCommerce

AI Verified

2

Bypass logout confirmation.

Added: 2 years ago

Last Updated: 3 months ago