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
/** | |
* Override WooCommerce tax display option for distributors. | |
* | |
* @see http://stackoverflow.com/questions/29649963/displaying-taxes-in-woocommerce-by-user-role | |
* @see https://www.businessbloomer.com/woocommerce-check-if-products-belongs-to-category-tag/ | |
*/ | |
add_filter( 'woocommerce_before_cart_contents', 'tax_category_role', 1, 2 ); | |
add_filter( 'woocommerce_before_shipping_calculator', 'tax_category_role', 1, 2); | |
add_filter( 'woocommerce_before_checkout_billing_form', 'tax_category_role', 1, 2 ); |
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
<?php | |
/* Ocultar Secciones en Mi Cuenta Woocommerce */ | |
add_filter( 'woocommerce_account_menu_items', 'hideSectionProfile', 999 ); | |
function hideSectionProfile( $items ) | |
{ | |
unset($items['downloads']); | |
unset($items['dashboard']); | |
return $items; |
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
<?php | |
/** | |
* @snippet Displaying quantity setting fields on admin product pages | |
* @based on https://stackoverflow.com/questions/62943477/set-quantity-minimum-maximum-and-step-at-product-level-in-woocommerce | |
*/ | |
add_action( 'woocommerce_product_options_pricing', 'wc_qty_add_product_field' ); | |
function wc_qty_add_product_field() { | |
global $product_object; |
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
<?php | |
/** | |
* @snippet Enviar email al admin por cada registro de cliente | |
* @author https://docs.woocommerce.com/document/notify-admin-new-account-created/ | |
*/ | |
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 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
<?php | |
/** | |
* @snippet redirigir a pedidos desde el principal del dashboard de /mi-cuenta | |
* @author https://rudrastyh.com/woocommerce/remove-dashboard-from-my-account-menu.html#redirect-to-orders | |
*/ | |
add_action('template_redirect', 'redirect_to_orders_from_dashboard' ); | |
function redirect_to_orders_from_dashboard(){ | |
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
<?php | |
/** | |
* @snippet Capacidad de asignar roles a shop manager | |
* @author https://wordpress.org/support/topic/shop-manager-role-cannot-change-users-role/ | |
*/ | |
function myextension_shop_manager_role_edit_capabilities( $roles ) { | |
$roles[] = 'pending'; | |
$roles[] = 'customer'; |
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
<?php | |
/** | |
* @snippet v Alter the primary column in edit.php table(s) | |
* @author https://developer.wordpress.org/reference/hooks/list_table_primary_column/ | |
*/ | |
function my_list_table_primary_column( $default, $screen ) {// | |
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
<?php | |
/** | |
* @snippet Modificar el listado de usuarios en el panel de administración | |
* @based on https://wordpress-heroes.com/modificar-el-listado-de-usuarios-en-el-panel-de-administracion-de-wordpress/ | |
*/ | |
function jj_admin_user_columns($columns) { | |
unset($columns['posts']); //entradas | |
unset($columns['username']); //nombre de usuario | |