Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oscar-Abad-Folgueira/3233909aa2706c587162883c92d3ba60 to your computer and use it in GitHub Desktop.
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)
<?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