Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vandaal_variable_price_format( $price, $product ) {
- $prefix = sprintf('%s: ', __('Od', 'vandaal')); // zde si zadejte co má být před cenou, například Od nebo Cena Od
- $min_price_regular = $product->get_variation_regular_price( 'min', true );
- $min_price_sale = $product->get_variation_sale_price( 'min', true );
- $max_price = $product->get_variation_price( 'max', true );
- $min_price = $product->get_variation_price( 'min', true );
- $price = ( $min_price_sale == $min_price_regular ) ?
- wc_price( $min_price_regular ) :
- '<del>' . wc_price( $min_price_regular ) . '</del>' . '<ins>' . wc_price( $min_price_sale ) . '</ins>';
- return ( $min_price == $max_price ) ?
- $price :
- sprintf('%s%s', $prefix, $price);
- }
- add_filter( 'woocommerce_variable_sale_price_html', 'vandaal_variable_price_format', 10, 2 );
- add_filter( 'woocommerce_variable_price_html', 'vandaal_variable_price_format', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement