Last active
March 16, 2021 07:17
-
-
Save Oscar-Abad-Folgueira/3233909aa2706c587162883c92d3ba60 to your computer and use it in GitHub Desktop.
WooCommerce Snippet: Añadir texto gratis si el producto tiene precio cero (0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @snippet WooCommerce Snippet: Añadir texto gratis si el producto tiene precio cero (0). | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/anadir-el-texto-gratis-en-los-productos-con-precio-cero-en-woocommerce | |
*/ | |
add_filter( 'woocommerce_get_price_html', 'mensaje_precio_cero' ); | |
function mensaje_precio_cero($price) { | |
if(!empty($price)){ | |
$mensaje = ' ¡¡¡Gratis!!!!'; | |
return $price . $mensaje; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment