• Resolved Nichlas Brandon

    (@calorius)


    Hi! I was excited to see a new update for this plugin. I was wondering if it’s possible to use a functions.php snippet to set PreferredCountries? I want to have it as preferredCountries:[“us”,”ca”,”gb”]

    Right now, I’m editing these two files to set them:

    intlTelInput-jquery.min.js
    intlTelInput.min.js

    But that’s of course not ideal as they’ll be overwritten with each update.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Precious Omonzejele

    (@preciousomonze)

    Hello, thanks. Been so slow in pushing an update??, my bad.
    It actuaLly didn’t occur to me to add this to custom filtering
    https://gist.github.com/Preciousomonze/03c54e7e0cc0e11ca709832bc757810b
    That’s a list of all filter hooks and how to implement, for customisation.
    Although Prefered country isn’t on the list.
    I’ll be doing an update to include that(I’ll be faster this time around ??).

    For the mean time you can edit the frontend.js (if you have script_debug turned on, this is the file called) or frontend.min.Js file.

    So I’ll advice you edit the frontend.js on line 21 after separateDialCode: separateDialCode, you add your prefered countries code there.
    To update frontend.min.js, you have to minify your new frontend.js.
    I am assuming you have a Javascript coding background. If not l, you can wait for an update.

    Thread Starter Nichlas Brandon

    (@calorius)

    Thank you for the elaborate response, much appreciated!

    I’m unfortunately not experienced enough with JavaScript to do this, so will look forward to the update. ??

    Plugin Author Precious Omonzejele

    (@preciousomonze)

    Hello, theres a new update.
    Update to the latest version, after that:

    function pekky_cx_preferred_countries( $countries ){
    	$countries = array('ng','gh','es');
    	return $countries;
    }
    add_filter( 'wc_pv_preferred_countries', 'pekky_cx_preferred_countries' );

    replace the countries to suite your need, add to your functions.php

    Marking this as resolved!
    And Please do not forget to rate ????
    Do have a nice day and don’t forget to try out pancakes! ????

    Thread Starter Nichlas Brandon

    (@calorius)

    That’s fantastic! Added and tweaked the code, it works perfectly!

    I’ll be sure to rate the plugin, thank you so much! ??

    #Pancakes ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to Set PreferredCountries?’ is closed to new replies.