PATH:
home
/
shotlining
/
portal.shotlining.com
/
wp-content
/
plugins
/
custom-user-discount
<?php /* Plugin Name: Custom User Discount Description: Applies a hidden 5% discount for specific user emails. */ add_action('woocommerce_cart_calculate_fees', 'custom_discount_for_specific_users'); function custom_discount_for_specific_users($cart) { if (is_admin() && !defined('DOING_AJAX')) return; $user = wp_get_current_user(); if (!$user || !is_user_logged_in()) return; // ✅ List of emails allowed for discount $approved_emails = [ 'discountcontractor@gmail.com', 'jill@shotlining.com', 'victoria@shotlining.com', // 'newclient@company.com', ]; if (in_array($user->user_email, $approved_emails)) { $discount = $cart->subtotal * 0.05; $cart->add_fee(' ', -$discount); // hidden label = invisible in cart } } // <?php // /* // Plugin Name: Custom User Discount // Description: Applies a 5% discount for specific users in WooCommerce cart. // Version: 1.0 // */ // add_action('woocommerce_cart_calculate_fees', 'custom_discount_for_specific_user'); // function custom_discount_for_specific_user($cart) { // if (is_admin() && !defined('DOING_AJAX')) return; // $user = wp_get_current_user(); // // Replace this with the actual customer email // if ($user && $user->user_email == 'christianscheder@gmail.com') { // $discount = $cart->subtotal * 0.05; // 5% discount // $cart->add_fee('5% Discount', -$discount); // } // }
[-] custom-user-discount.php
[edit]
[+]
..
[-] .htaccess
[edit]