Product Helper Shortcode

Below, you’ll find a detailed guide on how to add the Product Helper Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Product Helper Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the Product Helper Plugin and the shortcodes it provides:

Plugin Icon Product Helper

" Product Helper is a user-friendly WordPress plugin designed to streamline your integration with, making it simpler to manage and showcase your accommodation listings."

★☆✩✩✩ (5) Active Installs: 4000+ Tested with: 5.9.8 PHP Version: 7.2.8
Included Shortcodes:
  • [booking_product_helper] Product Helper [booking_product_helper] Shortcode

The ‘booking_product_helper’ shortcode from the Product Helper plugin retrieves the widget code for a specified product. It accepts ‘shortname’ as an attribute, which is used to fetch the relevant widget code. If the ‘shortname’ is not set or is invalid, it returns an empty string. The shortcode then retrieves the widget code from the options table using the get_option function. If the ‘code_content’ is available and not empty, it is returned wrapped in script tags.

Shortcode: [booking_product_helper]


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

  • shortname – specifies the unique name for the booking product

Examples and Usage

Basic example – A basic usage of the shortcode to retrieve a widget by its shortname.

[booking_product_helper shortname="hotel1" /]

Advanced examples

Use the shortcode to retrieve a widget by its shortname, and if it doesn’t exist, the shortcode will return an empty string.

[booking_product_helper shortname="nonexistent_shortname" /]

Another advanced example would be to use the shortcode without any shortname. In this case, the shortcode will return an empty string as there is no specific widget to retrieve.

[booking_product_helper /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'booking_product_helper', 'bcph_get_bookingcom_widget_code' );

Shortcode PHP function:

function bcph_get_bookingcom_widget_code( $atts ) {
				'shortname' => false,

	if ( ! isset( $shortname ) || ! $shortname ) {
		return '';

	$option_content = get_option( 'booking_product_helper_shortname-' . $shortname );

	if ( isset( $option_content ) && ! empty( $option_content ) ) {
		//return $option_content['code_content'];
		//Add script tags
		$booking_product_shortcode = wp_unslash( wp_kses_post( $option_content['code_content'] ) ); //for legacy shortcodes before ver. 1.0.2
		$booking_product_shortcode = str_replace( '</ins>', '</ins><script>', $booking_product_shortcode );
		$booking_product_shortcode = $booking_product_shortcode . '</script>';
		return $booking_product_shortcode;

Code file location:



Now that you’ve learned how to embed the Product Helper Plugin shortcode, 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.


Leave a Reply

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