This file contains hidden or 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
/*OPCIÓN 1: Primero activar checkbox "Redirigir a la página del carrito tras añadir productos con éxito"*/ | |
function cod_redirect_checkout_add_cart( $url ) { | |
$url = wc_get_page_permalink( 'checkout' ); | |
return $url; | |
} | |
add_filter( 'woocommerce_add_to_cart_redirect', 'cod_redirect_checkout_add_cart' ); | |
/*OPCIÓN 2*/ | |
/* Enviar directamente al pago */ |
This file contains hidden or 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
// NUEVO SHORTCODE PARA REGISTRO: [wc_reg_form_bbloomer] | |
add_shortcode( 'wc_reg_form_bbloomer', 'bbloomer_separate_registration_form' ); | |
function bbloomer_separate_registration_form() { | |
if ( is_admin() ) return; | |
if ( is_user_logged_in() ) return; | |
ob_start(); | |
// NOTE: THE FOLLOWING <FORM></FORM> IS COPIED FROM woocommerce\templates\myaccount\form-login.php |
This file contains hidden or 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
/* Enviar directamente al pago */ | |
add_filter ('add_to_cart_redirect', 'redirect_to_checkout'); | |
function redirect_to_checkout() { | |
global $woocommerce; | |
$checkout_url = $woocommerce->cart->get_checkout_url(); | |
return $checkout_url; | |
} |
This file contains hidden or 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
/*Aviso bajo imagen en pdto único*/ | |
add_action( 'woocommerce_after_single_product_summary' , 'bbloomer_add_below_prod_gallery', 5 ); | |
function bbloomer_add_below_prod_gallery() { | |
echo '<div class="woocommerce-product-gallery" style="background: #51559f; padding: 1em 2em; color: #ffffff;">'; | |
echo '<span>Todas las descargas equivalen a 1 crédito, <b><a href="https://pruebas.marceloglez.com">elije tu plan</a>.</span></b>'; | |
echo '</div>'; | |
} |
This file contains hidden or 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
/*Desactivar efectos de foto en página de producto*/ | |
add_action( 'wp', 'bbloomer_remove_zoom_lightbox_theme_support', 99 ); | |
function bbloomer_remove_zoom_lightbox_theme_support() { | |
remove_theme_support( 'wc-product-gallery-zoom' ); | |
remove_theme_support( 'wc-product-gallery-lightbox' ); | |
remove_theme_support( 'wc-product-gallery-slider' ); | |
} |
This file contains hidden or 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
/*Genera un checkbox en registro para aceptar la política de privacidad cumpliendo con la RGPD Europea*/ | |
add_action( 'woocommerce_register_form', 'bbloomer_add_registration_privacy_policy', 11 ); | |
function bbloomer_add_registration_privacy_policy() { | |
woocommerce_form_field( 'privacy_policy_reg', array( | |
'type' => 'checkbox', | |
'class' => array('form-row privacy'), | |
'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'), | |
'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'), |
This file contains hidden or 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
/*Añade fecha a producto único*/ | |
add_action( 'woocommerce_single_product_summary','bloomer_echo_product_date',25 ); | |
function bloomer_echo_product_date() { | |
if ( is_product() ) { | |
echo the_date('', '<span class="date_published"> 📂 Actualizado: ', '</span>', false); | |
} | |
} |
This file contains hidden or 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
/*Añade categoría a producto en Tienda*/ | |
add_action('woocommerce_shop_loop_item_title', 'add_tags_and_category', 15); | |
function add_tags_and_category() { ?> | |
<span class="tags"> | |
<?php $product_terms = get_the_terms( get_the_ID(), 'product_cat'); | |
if( $product_terms && ! is_wp_error( $product_terms ) ) : | |
foreach( $product_terms as $term) : ?> | |
<span><?php echo $term->name; ?></span> | |
<?php endforeach; | |
endif; ?> |
This file contains hidden or 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
/*Enlace de descarga directa de producto comprado en página de producto*/ | |
add_action('woocommerce_after_add_to_cart_form', 'download_products'); | |
function download_products() | |
{ | |
global $product; | |
$downloads = array(); | |
$user_id = get_current_user_id(); | |
$downloads = wc_get_customer_available_downloads($user_id); |
This file contains hidden or 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
// Quitar enlace al nombre de producto en mis descargas | |
add_action( 'woocommerce_account_downloads_column_download-product', 'custom_account_downloads_product_column' ); | |
function custom_account_downloads_product_column( $download ){ | |
// Display the product name without the link | |
echo esc_html( $download['product_name'] ); | |
} |