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 | |
/* Traducir cualquier texto en WordPress */ | |
add_filter( 'gettext', 'traducir_cualquier_texto', 10, 3 ); | |
function traducir_cualquier_texto( $translated, $original, $domain ) | |
{ | |
if ( $translated == "Shipping and delivery" ) { | |
$translated = "Envío y Entrega"; | |
} | |
if ( $original == "Delivery Date" ) { |
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 | |
/* Enviar email al admin por cada registro de cliente */ | |
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' ); | |
function woocommerce_created_customer_admin_notification( $customer_id ) | |
{ | |
wp_send_new_user_notifications( $customer_id, 'admin' ); | |
} |
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
/** | |
* @snippet Añadir atributos de producto en las paginas woocommerce (ocultando los atributos de variaciones fuera de stock) | |
* @author https://fsxperts.com/how-to-show-product-attributes-on-category-page/ | |
* @author https://stackoverflow.com/questions/30855309/how-to-check-product-have-variation-in-woocommerce | |
*/ | |
add_action('woocommerce_after_shop_loop_item_title','mostrar_atributos_disponibles'); | |
/** | |
* @snippet // Add product attributes in summary (single product page). Entre el precio y descripcion corta | |
* @author https://stackoverflow.com/questions/13374883/get-custom-product-attributes-in-woocommerce |
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
/** | |
* @snippet Añadir confirmación de contraseña en el registro woocommerce | |
* @author @jose64 | |
*/ | |
//1. Verifica que la opción de generar la contraseña automáticamente no esté activada en la configuración de WooCommerce | |
function wc_register_form_password_validation() { | |
if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) { | |
?> | |
<p class="form-row form-row-wide"> |
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
/** | |
* @author https://stackoverflow.com/questions/21672870/woocommerce-remove-meta-boxes | |
* @author https://wp-kama.com/plugin/woocommerce/hook/woocommerce_product_data_tabs | |
*/ | |
//Eliminar metaboxes | |
function remove_metaboxes() { | |
//remove_meta_box( 'postexcerpt' , 'product' , 'normal' ); Descripcion corta | |
remove_meta_box( 'tagsdiv-product_tag' , 'product' , 'side' ); //tags | |
//remove_meta_box( 'yoast_internal_linking' , 'product' , 'side' ); //tags |
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
/** | |
* @author https://stackoverflow.com/questions/21672870/woocommerce-remove-meta-boxes | |
* @author https://wp-kama.com/plugin/woocommerce/hook/woocommerce_product_data_tabs | |
*/ | |
//Eliminar tabs de metabox DATOS DEL PRODUCTO | |
function remove_tab($tabs){ | |
//unset($tabs['general']); | |
//unset($tabs['inventory']); |
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
/** | |
* @snippet Añadir atributos de producto en las paginas de categorias (ocultando los atributos de variaciones fuera de stock) | |
* @author https://fsxperts.com/how-to-show-product-attributes-on-category-page/ | |
* @author https://stackoverflow.com/questions/30855309/how-to-check-product-have-variation-in-woocommerce | |
*/ | |
add_action('woocommerce_before_shop_loop_item_title','mostrar_atributos_disponibles'); | |
/* @visual_hook_guide: https://www.businessbloomer.com/woocommerce-visual-hook-guide-archiveshopcat-page/*/ | |
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
/** | |
* @snippet Hide shipping rates when free shipping is available. | |
* @author JJMontalban | |
*/ | |
function my_hide_shipping_when_free_is_available( $rates ) { | |
$free = array(); | |
foreach ( $rates as $rate_id => $rate ) { | |
if ( 'free_shipping' === $rate->method_id ) { | |
$free[ $rate_id ] = $rate; | |
break; |
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
/** | |
* @snippet Guarda campos de pago en el checkout aunn actualizando | |
* @author JJMontalban | |
*/ | |
function guarda_campos_pago( $posted_data ) { | |
parse_str( $posted_data, $output ); | |
WC()->session->set( 'checkout_data', $output ); | |
return $posted_data; | |
} |