WBW Currency Switcher for WooCommerce Shortcodes

Below, you’ll find a detailed guide on how to add the WBW Currency Switcher for WooCommerce Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the WBW Currency Switcher for WooCommerce Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the WBW Currency Switcher for WooCommerce Plugin and the shortcodes it provides:

✩✩✩✩✩ () Active Installs: + Tested with: PHP Version:
Included Shortcodes:

WBW Currency Switcher for WooCommerce [WCU_SHORTCODE_SWITCHER] Shortcode

The Woo-Currency Plugin shortcode is a versatile tool that allows customization of the currency switcher widget. This shortcode draws the switcher widget, with attributes controlling display aspects. It checks if ‘exclude’ attribute exists and is not an array, then converts it into one. It sets default parameters like ‘currency_display’, ‘show_as’, ‘width’, and ‘exclude’. The ‘show_on’ attribute controls where the widget is displayed, while ‘show_on_widths’ and ‘show_on_screen_compare’ allow responsive design.

Shortcode: [WCU_SHORTCODE_SWITCHER]

Parameters

Here is a list of all possible WCU_SHORTCODE_SWITCHER shortcode parameters and attributes:

  • currency_display – Determines how to display the currency, as name or symbol.
  • show_as – Defines how to present the currency switcher, as dropdown or inline.
  • show_flag_dropdown – If true, shows country flag in the dropdown menu.
  • width – Sets the width of the currency switcher widget.
  • exclude – Specifies which currencies to exclude from the switcher.
  • show_on – Defines where to display the switcher, on desktop, mobile or both.
  • show_on_widths – Sets minimum screen width to display the switcher.
  • show_on_screen_compare – If ‘less’, switcher displays on screens smaller than ‘show_on_widths’ value.
  • show_on_widths_value – Value to compare with ‘show_on_widths’ to decide whether to show the switcher.

Examples and Usage

Basic example – A simple usage of the shortcode to display a currency switcher widget.

[WCU_SHORTCODE_SWITCHER]

Under the ‘Advanced examples’, we can see how to use the shortcode with different parameters to customize the currency switcher widget.

Advanced example 1 – Displaying the currency switcher widget as a dropdown with currency flags.

[WCU_SHORTCODE_SWITCHER show_as="dropdown" show_flag_dropdown=true]

Advanced example 2 – Excluding certain currencies from the switcher widget.

[WCU_SHORTCODE_SWITCHER exclude="USD,EUR"]

Advanced example 3 – Displaying the currency switcher widget on both desktop and mobile screens, with a specific width.

[WCU_SHORTCODE_SWITCHER show_on="both" width="50%"]

Advanced example 4 – Displaying the currency switcher widget only on screens smaller than a certain width.

[WCU_SHORTCODE_SWITCHER show_on_screen_compare="less" show_on_widths_value="600"]

These examples illustrate how you can use the shortcode with various parameters to customize the appearance and functionality of the currency switcher widget according to your needs.

PHP Function Code

In case you have difficulties debugging what causing issues with [WCU_SHORTCODE_SWITCHER] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode(WCU_SHORTCODE_SWITCHER, array($this, 'drawSwitcherWidget'));

Shortcode PHP function:

function drawSwitcherWidget($atts) {
		if (is_array($atts) && array_key_exists('exclude', $atts) && (!is_array($atts['exclude']))) {
			$atts['exclude'] = explode(',', $atts['exclude']);
		}
		$params = shortcode_atts( array(
			'currency_display' => 'name',
			'show_as' => 'dropdown',
			'show_flag_dropdown' => false,
			'width' => '100%',
			'exclude' => array(),
			'show_on' => 'both',
			'show_on_widths' => 0,
			'show_on_screen_compare' => 'less',
			'show_on_widths_value' => '',
		), $atts );
		return frameWcu::_()->getModule('currency_widget')->getView()->displayWidget($params, 'currencySwitcher');
	}

Code file location:

woo-currency/woo-currency/modules/currency_widget/mod.php

WBW Currency Switcher for WooCommerce [WCU_SHORTCODE_CONVERTER] Shortcode

The Woo-Currency Converter shortcode is a tool that allows you to display a currency conversion widget on your WordPress site. This shortcode uses the ‘drawConverterWidget’ function, which lets you customize the widget’s appearance and functionality. You can set the currency display, choose to show flags in the dropdown, adjust the layout, modify button colors, and more. The shortcode also has responsive settings, allowing you to control the widget’s visibility based on screen size.

Shortcode: [WCU_SHORTCODE_CONVERTER]

Parameters

Here is a list of all possible WCU_SHORTCODE_CONVERTER shortcode parameters and attributes:

  • currency_display – determines how the currency is shown, by name or symbol.
  • show_flag_dropdown – decides if a flag dropdown menu is displayed or not.
  • layout – sets the layout direction, vertical or horizontal.
  • btn_txt_color – sets the color of the button text.
  • btn_bg_color – sets the color of the button background.
  • btn_bg_color_h – sets the hover color of the button background.
  • width – defines the width of the widget, in percentage.
  • exclude – allows certain currencies to be excluded from display.
  • show_on – sets where the widget is displayed, on mobile, desktop or both.
  • show_on_widths – sets the minimum screen width to display the widget.
  • show_on_screen_compare – sets the comparison for screen width display condition.
  • show_on_widths_value – sets the value for screen width comparison.

Examples and Usage

Basic example – A basic usage of the WCU_SHORTCODE_CONVERTER shortcode to display a currency converter widget.

[WCU_SHORTCODE_CONVERTER]

Advanced examples

Using the WCU_SHORTCODE_CONVERTER shortcode to display a currency converter widget with the currency display set to symbol, layout set to horizontal, and the button text color set to black.

[WCU_SHORTCODE_CONVERTER currency_display="symbol" layout="horizontal" btn_txt_color="black"]

Using the WCU_SHORTCODE_CONVERTER shortcode to display a currency converter widget with a custom width, a specific button background color, and excluding certain currencies.

[WCU_SHORTCODE_CONVERTER width="50%" btn_bg_color="#000" exclude="USD,EUR"]

Using the WCU_SHORTCODE_CONVERTER shortcode to display a currency converter widget that only shows on specific screen sizes, with a custom button hover color.

[WCU_SHORTCODE_CONVERTER show_on="mobile" show_on_widths="480" btn_bg_color_h="#e58004"]

PHP Function Code

In case you have difficulties debugging what causing issues with [WCU_SHORTCODE_CONVERTER] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode(WCU_SHORTCODE_CONVERTER, array($this, 'drawConverterWidget'));

Shortcode PHP function:

function drawConverterWidget($atts) {
		if (is_array($atts) && array_key_exists('exclude', $atts) && (!is_array($atts['exclude']))) {
			$atts['exclude'] = explode(',', $atts['exclude']);
		}
		$params = shortcode_atts( array(
			'currency_display' => 'name',
			'show_flag_dropdown' => false,
			'layout' => 'vertical',
			'btn_txt_color' => 'white',
			'btn_bg_color' => '#333',
			'btn_bg_color_h' => '#e58004',
			'width' => '100%',
			'exclude' => array(),
			'show_on' => 'both',
			'show_on_widths' => 0,
			'show_on_screen_compare' => 'less',
			'show_on_widths_value' => '',
		), $atts );
		return frameWcu::_()->getModule('currency_widget')->getView()->displayWidget($params, 'currencyConverter');
	}

Code file location:

woo-currency/woo-currency/modules/currency_widget/mod.php

WBW Currency Switcher for WooCommerce [WCU_SHORTCODE_RATES] Shortcode

The Woo-Currency plugin shortcode is designed to display a currency rates widget. It allows customization such as currency display type, flag dropdown, and width. The shortcode also includes features to exclude certain currencies and control visibility based on screen size. It offers great flexibility for any e-commerce site.

Shortcode: [WCU_SHORTCODE_RATES]

Parameters

Here is a list of all possible WCU_SHORTCODE_RATES shortcode parameters and attributes:

  • currency_display – Defines how the currency is displayed, as name or symbol.
  • show_flag_dropdown – Controls if a flag dropdown is shown, true or false.
  • show_flag_currency_list – Controls if a flag currency list is displayed, true or false.
  • width – Sets the width of the currency widget, usually in percentage.
  • exclude – Specifies the currencies to exclude from the widget, as an array.
  • show_on – Determines where the widget is displayed, options include ‘both’, ‘desktop’, ‘mobile’.
  • show_on_widths – Defines the width at which the widget displays, in pixels.
  • show_on_screen_compare – Sets the condition for widget display based on screen width, ‘less’ or ‘more’.
  • show_on_widths_value – Specifies the screen width value for the ‘show_on_screen_compare’ condition.

Examples and Usage

Basic example – Display currency rates with default settings

[WCU_SHORTCODE_RATES]

Advanced examples

Display currency rates with a custom width and without certain currencies. The width is set to 70% and the currencies to exclude are USD and EUR.

[WCU_SHORTCODE_RATES width="70%" exclude="USD,EUR"]

Display currency rates with flags in the dropdown and the currency list. The flags are shown in both the dropdown and the currency list.

[WCU_SHORTCODE_RATES show_flag_dropdown=true show_flag_currency_list=true]

Display currency rates based on screen size. The rates are only shown on screens that are less than 500px wide.

[WCU_SHORTCODE_RATES show_on="both" show_on_widths=500 show_on_screen_compare="less"]

PHP Function Code

In case you have difficulties debugging what causing issues with [WCU_SHORTCODE_RATES] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode(WCU_SHORTCODE_RATES, array($this, 'drawRatesWidget'));

Shortcode PHP function:

function drawRatesWidget($atts) {
		if (is_array($atts) && array_key_exists('exclude', $atts) && (!is_array($atts['exclude']))) {
			$atts['exclude'] = explode(',', $atts['exclude']);
		}
		$params = shortcode_atts( array(
			'currency_display' => 'name',
			'show_flag_dropdown' => false,
			'show_flag_currency_list' => false,
			'width' => '100%',
			'exclude' => array(),
			'show_on' => 'both',
			'show_on_widths' => 0,
			'show_on_screen_compare' => 'less',
			'show_on_widths_value' => '',
		), $atts );
		return frameWcu::_()->getModule('currency_widget')->getView()->displayWidget($params, 'currencyRates');
	}

Code file location:

woo-currency/woo-currency/modules/currency_widget/mod.php

Conclusion

Now that you’ve learned how to embed the WBW Currency Switcher for WooCommerce Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *