/** * Snippet: Apply Coupon when a radio button is clicked on The Product Page * Author: https://profiles.wordpress.org/kishores * Url: https://upnrunn.com * Note: Please make sure to create the coupon in the WC Admin */ // Add radio button below…Continue reading
/** * Snippet Name: Exclude Product From Discount Coupons. */ add_filter( ‘woocommerce_coupon_is_valid_for_product’, ‘exclude_product_from_product_promotions’, 999, 4 ); function exclude_product_from_product_promotions( $valid, $product, $coupon, $values ) { // Product id here (i.e. 123) if ( 123 == $product->get_id() ) { $valid = false;…Continue reading
/** * Snippet Name: Apply discount on the cheapest item */ add_action( ‘woocommerce_before_calculate_totals’, ‘apply_discount_on_cheapest_item’, 999 ); function apply_discount_on_cheapest_item( $cart ) { if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ) return; if ( did_action( ‘woocommerce_before_calculate_totals’ ) >= 2 ) return;…Continue reading
/** * Snippet: Disable a Payment Gateway for a country */ add_filter( ‘woocommerce_available_payment_gateways’, ‘disable_payment_gateway_based_on_country’, 9999 ); function disable_payment_gateway_based_on_country( $available_gateways ) { if ( is_admin() ) return $available_gateways; if ( isset( $available_gateways[‘stripe’] ) && WC()->customer && WC()->customer->get_billing_country() == ‘IN’ ) {…Continue reading
add_filter( ‘charitable_default_donation_fields’, ‘charitable_filter_countries_donation_form’, 10, 1 ); function charitable_filter_countries_donation_form( $donation_fields = array() ) { if ( empty( $donation_fields[‘country’][‘donation_form’][‘options’] ) ) { return $donation_fields; } $countries_for_donation_form = $donation_fields[‘country’][‘donation_form’][‘options’]; // you can remove a country. unset( $countries_for_donation_form[‘CA’] ); // ..or you can create…Continue reading
/** * Conditionally show the submit button * * @link https://wpforms.com/developers/how-to-conditionally-show-the-submit-button/ */ add_action( ‘wp_head’, function () { ?>Continue reading
function custom_default_avatar($avatar_defaults) { $myavatar = ‘https://pharmacyneeds.gr/wp-content/uploads/2024/06/PharamcyNeeds-Logo-User.png.png’; $avatar_defaults[$myavatar] = “Default Avatar”; return $avatar_defaults; } add_filter(‘avatar_defaults’, ‘custom_default_avatar’); function set_custom_avatar( $avatar, $id_or_email, $size, $default, $alt ) { $custom_avatar_url = ‘https://pharmacyneeds.gr/wp-content/uploads/2024/06/PharamcyNeeds-Logo-User.png.png’; // Check if the user has a gravatar $user_avatar = get_avatar_data($id_or_email); // If…Continue reading
function check_disposable_email_domains($user_id) { // Λήψη του email του χρήστη με το user ID $user_info = get_userdata($user_id); $user_email = $user_info->user_email; // Extensive list of temporary email domains it wants you to block $blocked_domains = array( ‘secmail.pro’, ‘secmail.net’, ‘secmail.org’, ‘secmail.com’, ‘tempmail.com’,’1secmail.com’, ’10minutemail.com’,…Continue reading