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 Traducir cualquier texto en WordPress | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/como-traducir-cualquier-texto-en-wordpress/ | |
*/ | |
add_filter( 'gettext', 'traducir_cualquier_texto', 10, 3 ); |
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 Cambiar el número de productos por línea en WooCommerce | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/cambiar-el-numero-de-productos-por-fila-en-woocommerce/ | |
*/ | |
add_filter('loop_shop_columns', 'loop_columns', 999); | |
if (!function_exists('loop_columns')) { |
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 Añadir un producto al carrito de Woocommerce automaticamente con código | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/anadir-un-producto-al-carrito-de-woocommerce-automaticamente-mediante-codigo/ | |
*/ | |
add_action( 'template_redirect', 'add_product_to_cart_automatically' ); | |
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 Obtener el número de prodcutos que hay en el carrito de WooCommerce | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/obtener-el-numero-de-productos-que-hay-en-el-carrito-de-woocommerce/ | |
*/ | |
echo "Total productos: " . WC()->cart->get_cart_contents_count(); |
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 Comprobar si un producto está en el carrito de WooCommerce | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/comprobar-si-un-producto-esta-en-el-carrito-de-woocommerce/ | |
*/ | |
add_action( 'template_redirect', 'check_if_product_in_cart' ); | |
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 Comprobar si un producto está en el carrito de WooCommerce y si está, añadir otro producto de regalo | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/comprobar-si-un-producto-esta-en-el-carrito-de-woocommerce/ | |
*/ | |
add_action( 'template_redirect', 'check_if_product_in_cart' ); | |
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 Comprobar si el carrito de WooCommerce está vacío y si es así, añadir un producto | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/funcion-woocommerce-para-comprobar-si-el-carrito-esta-vacio/ | |
*/ | |
add_action( 'template_redirect', 'add_product_if_cart_empty' ); | |
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 Mostrar avisos en el carrito de WooCommerce para que el cliente compre 3 productos y obtenga producto regalo | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/como-crear-avisos-personalizados-en-woocommerce/ | |
*/ | |
add_action( 'template_redirect', 'aviso_compra3' ); | |
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 Establecer cantidad de compra de productos en WooCommerce de 2 en 2 | |
* @author Oscar Abad Folgueira | |
* @author_url https://www.oscarabadfolgueira.com | |
* @snippet_url https://www.oscarabadfolgueira.com/establecer-que-solo-se-puedan-comprar-cantidad-de-2-en-2-en-woocommerce/ | |
*/ | |
add_filter( 'woocommerce_quantity_input_args', 'woocommerce_quanty_imput_step', 10, 2 ); // Simple products |