Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_get_price_html', 'custom_price_html', 100, 2 );
- add_filter( 'woocommerce_cart_item_price', 'custom_price_html', 100, 2 );
- function custom_price_html( $price, $product )
- {
- global $post;
- $sales_price_to = get_post_meta($post->ID, '_sale_price_dates_to', true);
- $sales_price_from = get_post_meta($post->ID, '_sale_price_dates_from', true);
- if($sales_price_to != "")
- {
- setlocale(LC_TIME, 'pt_PT');
- $sales_price_date_to = strftime('%d %b', $sales_price_to);
- $sales_price_date_from = strftime('%d %b', $sales_price_from);
- return str_replace( '</ins>', ' </ins> <div class="promotion-text">De '.$sales_price_date_from.'. até '.$sales_price_date_to.'.</div>', $price );
- }
- else
- {
- return apply_filters( 'woocommerce_get_price', $price );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement