Flexible Shipping Shortcodes

Below, you’ll find a detailed guide on how to add the Flexible Shipping 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 Flexible Shipping Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Flexible Shipping Plugin and the shortcodes it provides:

Plugin Icon
Table Rate Shipping Method for WooCommerce by Flexible Shipping

"Table Rate Shipping Method for WooCommerce by Flexible Shipping is a robust plugin that enables custom shipping rates based on various parameters. This user-friendly tool significantly simplifies eCommerce logistics."

★★★★☆ (596) Active Installs: 100000+ Tested with: 6.3.2 PHP Version: 7.2
Included Shortcodes:
  • [unit_dimension]
  • [unit_weight]

Flexible Shipping [unit_dimension] Shortcode

The Flexible Shipping Plugin shortcode, ‘unit_dimension’, retrieves the unit of dimension set in WooCommerce settings. This shortcode displays the unit (like inches, cm) used for product dimensions in your WooCommerce store.

Shortcode: [unit_dimension]

Examples and Usage

Basic example – A simple usage of the ‘unit_dimension’ shortcode to display the dimension unit set in the WooCommerce settings.

[unit_dimension /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'unit_dimension', [ $this, 'shortcode_unit_dimension' ] );

Shortcode PHP function:

function shortcode_unit_dimension() {
		return '[' . get_option( 'woocommerce_dimension_unit', '' ) . ']';
	}

Code file location:

flexible-shipping/flexible-shipping/classes/table-rate/class-shortcode-unit-dimension.php

Flexible Shipping [unit_weight] Shortcode

The Flexible Shipping plugin shortcode, ‘unit_weight’, fetches the weight unit set in your WooCommerce settings. This shortcode, when used, will return the weight unit (kg, lbs, etc.) specified in your WooCommerce store settings. It offers a simple way to display your preferred weight unit across your site.

Shortcode: [unit_weight]

Examples and Usage

Basic example – The shortcode ‘unit_weight’ is designed to return the weight unit set in the WooCommerce settings. By default, it doesn’t require any parameters.

[unit_weight /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'unit_weight', [ $this, 'shortcode_unit_weight' ] );

Shortcode PHP function:

function shortcode_unit_weight() {
		return '[' . get_option( 'woocommerce_weight_unit', '' ) . ']';
	}

Code file location:

flexible-shipping/flexible-shipping/classes/table-rate/class-shortcode-unit-weight.php

Conclusion

Now that you’ve learned how to embed the Flexible Shipping 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 *