Location: everywhere
Apply Coupon when a radio button is clicked on The WooCommerce Product Page
/** * 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
Exclude Product From Discount Coupons in WooCommerce
/** * 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
Apply discount on the cheapest item in WooCommerce
/** * 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
Disable a Payment Gateway for a country on WooCommerce Checkout Page
/** * 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
Filter Countries JUST for Donation Forms
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
Replace WordPress Logo on Login Page
add_filter( ‘login_head’, function () { // Update the line below with the URL to your own logo. // Adjust the Width & Height accordingly. $custom_logo = ‘https://www.benefitscore.org/wp-content/uploads/2024/10/512×512-file-favi.svg’; $logo_width = 84; $logo_height = 84; printf( ‘ ‘, $custom_logo, $logo_width, $logo_height );…Continue reading
Gravity Forms Repeater Field for FAQs (Vendor and Venue)
/** * Purpose: This code dynamically adds an FAQ repeater field to two different forms (Form IDs 3 and 5) * within Gravity Forms. It allows for the creation of a set of “Frequently Asked Questions” fields * (question and…Continue reading
Gravity Forms Repeater Field for Video Galleries (Vendor and Venue)
/** * This code adds a video repeater field to specific Gravity Forms (IDs 3 and 5), pre-populates it with data from * ACF fields related to vendors or venues, and saves the submitted video gallery data back to the…Continue reading
Gravity Forms Repeater Field for Video Galleries (Vendor and Venue)
/** * This code adds a video repeater field to specific Gravity Forms (IDs 3 and 10), pre-populates it with data from * ACF fields related to vendors or venues, and saves the submitted video gallery data back to the…Continue reading