modify woocommerce states list

function custom_override_woocommerce_states( $states ) { // Override ‘AO’ states Արարատ. $states[‘AO’] = array( ‘AO1’ => __( ‘Ագարակ’, ‘woocommerce’ ), ‘AO2’ => __( ‘Ագարակավան’, ‘woocommerce’ ), ‘AO3’ => __( ‘Ալագյազ’, ‘woocommerce’ ), ‘AO4’ => __( ‘Ակունք’, ‘woocommerce’ ), ‘AO5’ => __(…Continue reading

modify woocommerce countries list

add_filter( ‘woocommerce_countries’, ‘modify_woocommerce_country_names’ ); function modify_woocommerce_country_names( $countries ) { // List of country codes to keep $allowed_countries = array( ‘ER’, ‘AO’, ‘DZ’, ‘AU’, ‘BD’, ‘BG’, ‘BJ’, ‘BO’, ‘BR’, ‘CA’, ‘CH’ ); // Loop through all countries and remove the ones…Continue reading

MemberPress: Require Coupon Code for Specific Free Memberships

// CHANGE this array – should be a comma separated list of Membership ID’s to apply the signup codes to $GLOBALS[‘free_memberships_require_coupon’] = array(123); function make_coupon_mandatory_free_membership($errors) { if(!isset($_POST[‘mepr_coupon_code’]) || trim($_POST[‘mepr_coupon_code’]) == ” && in_array($_POST[‘mepr_product_id’], $GLOBALS[‘free_memberships_require_coupon’])) { $errors[] = ‘A valid coupon…Continue reading

Remove “mail.readwrite” Scope for the Outlook Mailer

/* Removing “mail.readwrite” for the Outlook Mailer * * Original doc: https://wpmailsmtp.com/docs/removing-mail-readwrite-scope-for-the-outlook-mailer/ */ add_filter( ‘wp_mail_smtp_pro_providers_outlook_auth_get_scopes’, function ( $scopes ) { foreach ( $scopes as $key => $scope ) { if ( $scope === ‘https://graph.microsoft.com/mail.readwrite’ ) { unset( $scopes[ $key ]…Continue reading

Change Validation Messages for Required Fields – WPML

/** * Customize strings for WPForms form validation * * @link https://wpforms.com/developers/change-validation-messages-for-wpml/ */ function wpforms_dev_frontend_strings( $strings ) { $currentLanguage = defined( ‘ICL_LANGUAGE_CODE’ ) ? ICL_LANGUAGE_CODE : null; switch ( $currentLanguage ) { case ‘fr’: $strings[ ‘val_required’ ] = ‘Ce champ…Continue reading