Add flags to currency or country switchers with a code snippet

This document is deprecated. The widgets support flags since “Price Based on Country” version 3.0+. Review Widgets included with Price Based on Country

If you want to add flags to the “country/currency switcher,” and you aren’t a developer (or you don’t want to create a custom template for the widgets); you can use the following code snippet.

The code snippet replaces the select box into a jQuery element using the Select2 library.

country switcher with flags using Select2

You can customize the style of the switcher by adding additional CSS (at Appearance > Customize > Additional CSS)

Use the following CSS to adjust the width:

The following CSS removes the background:

See also: