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
//* Register widget areas | |
genesis_register_sidebar( array( | |
'id' => 'parallax-section-below-header', | |
'name' => __( 'Parallax Section Below Header', 'your-theme-slug' ), | |
'description' => __( 'This is the parallax section below header.', 'your-theme-slug' ), | |
) ); | |
genesis_register_sidebar( array( | |
'id' => 'parallax-section-above-footer', | |
'name' => __( 'Parallax Section Above Footer', 'your-theme-slug' ), |
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
//* Enqueue Dashicons | |
add_action( 'wp_enqueue_scripts', 'enqueue_dashicons' ); | |
function enqueue_dashicons() { | |
wp_enqueue_style( 'dashicons' ); | |
} |
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
// Personaliza texto stock bajo | |
add_filter( 'woocommerce_stock_html', 'custom_stock_message', 10, 3 ); | |
function custom_stock_message( $availability_html, $stock, $product ){ | |
$num_items_in_stock = $product->total_stock; | |
$availability = $product->get_availability(); | |
if ( $product->total_stock <= get_option( 'woocommerce_notify_low_stock_amount' ) ) { | |
$new_availability_html = '<p class="stock" style="color: #EA4242;margin-top: 5px;"> ¡Date prisa! Solo nos quedan ' . $num_items_in_stock . ' unidades</p>'; |
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
// Deshabilita la opción de pago contra-reembolso cuando el pedido supera los 100€ | |
add_filter( 'woocommerce_available_payment_gateways', 'disable_cod_gateway_by_cart_total_amount', 1 ); | |
function disable_cod_gateway_by_cart_total_amount( $gateways ){ | |
if( ( WC()->cart->total > 100 ) && ( array_key_exists( 'cod', $gateways ) ) ) { | |
unset( $gateways[ 'cod' ] ); | |
} | |
return $gateways; | |
} |
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
remove_action( 'woocommerce_archive_description', 'woocommerce_taxonomy_archive_description', 10 ); | |
add_action( 'woocommerce_after_shop_loop', 'woocommerce_taxonomy_archive_description' ); |
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
// Crea el rol de usuario "Cliente VIP" | |
add_action( 'init', 'crea_rol_cliente_vip' ); | |
function crea_rol_cliente_vip(){ | |
$customer_role = get_role( 'customer' ); | |
add_role( 'cliente_vip', __( 'Cliente VIP' ), $customer_role->capabilities ); | |
} | |
// Aplica un precio especial dependiento del tipo de usuario | |
add_filter( 'woocommerce_get_price', 'aplica_precio_especial', 10, 2); |
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
// Define una cantidad mínima por producto | |
add_action( 'woocommerce_check_cart_items', 'set_min_quantity_per_product' ); | |
function set_min_quantity_per_product() { | |
// Only run in the Cart or Checkout pages | |
if( is_cart() || is_checkout() ) { | |
global $woocommerce; | |
$i = 0; | |
// Lista de ID de productos y su cantidad mínima correspondiente | |
$product_min_qty = array( |
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
/** | |
* Comprueba que el campo NIF no esté vacío | |
*/ | |
add_action('woocommerce_checkout_process', 'comprobar_campo_nif'); | |
function comprobar_campo_nif() { | |
// Comprueba si se ha introducido un valor y si está vacío se muestra un error. | |
if ( ! $_POST['nif'] ) | |
wc_add_notice( __( 'NIF, es un campo requerido. Debe de introducir su NIF para finalizar la compra.' ), 'error' ); |
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
/** | |
* Incluye el campo NIF en el email de notificación del cliente | |
*/ | |
add_filter('woocommerce_email_order_meta_keys', 'muestra_campo_personalizado_email'); | |
function muestra_campo_personalizado_email( $keys ) { | |
$keys[] = 'NIF'; | |
return $keys; | |
} |
OlderNewer