<?php
add_filter( 'woocommerce_sale_price_html', 'woocommerce_sales_price_percentage', 10, 2 );
function woocommerce_sales_price_percentage( $price, $product ) {
$percentage = round( ( ( $product->regular_price - $product->sale_price ) / $product->regular_price ) * 100 );
return $price . sprintf( __(' - Save %s', 'woocommerce' ), $percentage . '%' );
}
?>
Sonuc;
Inga kommentarer:
Skicka en kommentar