Your wishlist is currently empty.
add_filter('woocommerce_get_price_html', 'custom_discount_display', 10, 2); function custom_discount_display($price_html, $product) { // Solo modificar el precio en las páginas de producto if (is_product()) { // Obtenemos el precio regular y el precio de venta $regular_price = $product->get_regular_price(); $sale_price = $product->get_sale_price(); if (!empty($sale_price) && $sale_price < $regular_price) { // Calculamos el descuento $discount = $regular_price - $sale_price; // Definimos los estilos $style = 'background-color: #D9534F; display: inline; padding: .2em .6em .3em; font-size: 75%; font-weight: bold; color: #fff; text-align: center; border-radius: .25em;'; // Verificamos el precio regular para determinar cómo mostrar el descuento if ($regular_price > 100) { // Si el precio regular es superior a 100€, mostramos el descuento en valor absoluto $price_html .= sprintf('
Your wishlist is currently empty.
You cannot copy content of this page