I installed the Total Donations plugin for a client to receive donations. However, donations can only be accepted from donors within the United States.  After finding no setting in the plug options to limit this I did a quick online search for a solution and found others have asked this question… but the first answer I read from the Author read, “That will need a modification code the the country drop down.”

Sounds like a crappy solution to me! That would potentially prevent one from updating the plugin… so that’s a non-starter.

It didn’t take much actual thinking to come up with a very simple solution. I happen to be using the Divi 2.x theme from Elegant Themes, and so in the Divi Theme Options > Integration I simply added this tiny script into the “Add code to the <body>” input:

jQuery(document).ready(function() {
jQuery(“.migla_country option:not([value=’United States’])”).remove();

One could easily add some more to the selector to better isolate the input in question to a particular form or page, but I’ve left it nice and generic here.  (Warning: in this generic form, the on-the-fly modification to the select list options will affect ALL select lists with the class “migla_country”.)  However, this simple solution will survive plugin updates (unless the author discontinues use of the “migla_country” class) and keeps the “State” select list included in the form.

Hope this helps somebody!