Docs

Shortcode generator and styling options

4 min readUpdated November 4, 2026

You can make the switcher button match your theme without writing any CSS (the code that styles web pages). The Shortcode tab builds the shortcode for you: you flip toggles and pick colours, watch a live preview, then copy the result. For example, a store with a dark header can give the button a dark background, light text and rounded corners, then paste one line into the header.

How it works#

The look of the button comes from three places, and the most specific one wins:

  1. The plugin’s built-in look: a transparent button that takes its text colour from your theme, with a thin border.
  2. General > Switcher Button Defaults: site-wide defaults for the border and text colour. They apply to every [wccs_switcher] that does not set those attributes itself.
  3. Attributes on the shortcode: for example bg="#0f172a". These always win over the defaults.

Build a shortcode with the generator#

  1. Go to WooCommerce > Currency Switch > Shortcode.
  2. Under Display, turn on the parts you want on the button: Show flag image, Show ISO code (USD), Show symbol ($), Show full name and Show chevron. The Preview updates as you go (hover states are not shown in the preview).
  3. Under Geometry, set Border Radius (px) with the slider (0 to 50), plus Padding and Button Font Size.
  4. Under Modal Text Sizes, optionally set the popup Title, Code and Name sizes.
  5. Under Colors, set Background, Text Color, Border Color, Hover Background, Hover Text and Hover Border. Use the colour picker, type a value, or click in a field and then click one of the variable chips (such as primary or white) to insert var(--primary).
  6. Click Copy next to the generated shortcode and paste it into your page, header or widget.
Shortcode tab: preview, generated shortcode and options

The generator only adds attributes that differ from the defaults, so the shortcode stays short. It also remembers your last choices in your browser, so you can come back and adjust them. Nothing on this tab needs saving.

Note

The Show modal search toggle starts in the same state as Show search bar in modal on the General tab, so by default the shortcode follows that setting. Change it only when this one switcher should be different: the shortcode then gets show_search="1" (on) or show_search="0" (off).

Styling attributes#

AttributeDefaultWhat it styles
bgtransparentButton background
coloryour theme’s text colour, or Text colour from the General tabButton text and icons
border_colorsame as the text colour, or Border colour from the General tabButton border. none removes the border.
border_width1Border thickness
border_radius6Corner rounding
padding7px 12pxSpace inside the button
font_size0.9emButton text size
font_weightyour theme’sButton text weight, for example 600
gap6pxSpace between the flag, code and arrow
hover_bg, hover_color, hover_bordersame as the normal stateBackground, text and border on hover
title_size1rem, or the General tab settingPopup title (“Select Currency”)
code_size0.8rem, or the General tab settingCurrency codes in the popup
name_size0.69rem, or the General tab settingCurrency names in the popup

border_width, gap and font_weight are not in the generator. Type them into the shortcode by hand.

Accepted values: hex colours (#fff, #1d4ed8), colour functions such as rgb() and hsl(), CSS variables such as var(--primary), and sizes such as 8px, 0.9em or 1rem. A plain number for border_width, border_radius, font_size, title_size, code_size or name_size is read as pixels, so border_radius="8" means 8px. For safety, a value that contains characters such as ;, {, } or quotes is ignored, and the default is used instead.

Site-wide button defaults#

Set these once on WooCommerce > Currency Switch > General, under Switcher Button Defaults, then click Save Changes.

General > Switcher Button Defaults
SettingDefaultWhat it does
Show borderOnShows a border on the button. Turn it off for borderless buttons everywhere.
Border colourblankA hex colour (#rrggbb). Blank uses the text colour.
Text colourblankA hex colour (#rrggbb). Blank uses your theme’s text colour.

These defaults apply to switchers added with the shortcode. Any border_color or color attribute on a shortcode overrides them.

Examples#

A dark button with rounded corners:

[wccs_switcher bg="#0f172a" color="#f8fafc" hover_bg="#1e293b" border_radius="8" padding="8px 16px"]

A button that uses your theme’s colour variables and has no border:

[wccs_switcher bg="var(--primary)" color="var(--white)" hover_bg="var(--primary-dark)" border_color="none"]

A pill-shaped button with bold text and bigger currency codes in the popup:

[wccs_switcher border_radius="50" font_weight="700" code_size="15px"]

Good to know#

  • A CSS variable only works if your theme or framework defines it. If var(--primary) is not defined on your site, that attribute has no effect.
  • Sizes set with title_size, code_size and name_size only change the popup of that one switcher. For all popups, use Modal Popup Typography on the General tab.
  • The popup’s highlight colour is not a shortcode attribute. Set it with Primary Color on the General tab.
  • Adding the currency switcher
  • Switcher popup design
  • Adding the switcher to your menus

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only