Ecwid Ecommerce Shopping Cart Shortcodes

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

Before starting, here is an overview of the Ecwid Ecommerce Shopping Cart Plugin and the shortcodes it provides:

Plugin Icon
Ecwid Ecommerce Shopping Cart

"Ecwid Ecommerce Shopping Cart is a robust plugin that transforms your WordPress site into a fully functional online store. It simplifies selling products online, offering user-friendly functions and easy setup."

★★★★✩ (223) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [vc_ecwid_store]
  • [ecwid_productbrowser]
  • [ecwid_searchbox]

Ecwid Ecommerce Shopping Cart [vc_ecwid_store] Shortcode

The vc_ecwid_store shortcode is a part of the Ecwid Shopping Cart plugin. It allows you to display a store with customizable features on your WordPress site. This shortcode lets you control the display of the search bar, categories, and mini cart. You can also set a default category ID. It’s designed to enhance the user shopping experience by providing a streamlined and customizable store interface.

Shortcode: [vc_ecwid_store]

Parameters

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

  • show_search – Controls the visibility of the search bar.
  • show_categories – Controls the visibility of the categories section.
  • show_minicart – Controls the visibility of the mini shopping cart.
  • default_category_id – Sets the default category that will be shown.

Examples and Usage

Basic example – A straightforward usage of the vc_ecwid_store shortcode, where all attributes are set to their default values. This will display the search, categories, and minicart widgets, with no default category specified.

[vc_ecwid_store]

Advanced examples

Using the shortcode to display only the search and minicart widgets, with a default category ID of 5. The ‘show_categories’ attribute is set to 0, which disables the categories widget.

[vc_ecwid_store show_search=1 show_categories=0 show_minicart=1 default_category_id=5]

Using the shortcode to display only the categories widget, with a default category ID of 10. The ‘show_search’ and ‘show_minicart’ attributes are set to 0, which disables the search and minicart widgets respectively.

[vc_ecwid_store show_search=0 show_categories=1 show_minicart=0 default_category_id=10]

Using the shortcode to display all three widgets, but with a default category ID of 20. This allows you to specify which category’s products should be displayed when the store is first loaded.

[vc_ecwid_store show_search=1 show_categories=1 show_minicart=1 default_category_id=20]

PHP Function Code

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

Shortcode line:

add_shortcode( 'vc_ecwid_store', array( $this, 'vc_ecwid_store' ) );

Shortcode PHP function:

function vc_ecwid_store( $atts ) {

		$atts = shortcode_atts(
			array(
				'show_search'         => 1,
				'show_categories'     => 1,
				'show_minicart'       => 1,
				'default_category_id' => 0,
			),
			$atts
		);

		$ecwid_attributes = array(
			'widgets' => '',
		);

		$widgets = array(
			'search',
			'categories',
			'minicart',
		);
		foreach ( $widgets as $widget ) {
			if ( $atts[ 'show_' . $widget ] ) {
				$ecwid_attributes['widgets'] .= $widget . ' ';
			}
		}

		$ecwid_attributes['widgets']            .= 'productbrowser';
		$ecwid_attributes['default_category_id'] = $atts['default_category_id'];

		return ecwid_shortcode( $ecwid_attributes );
	}

Code file location:

ecwid-shopping-cart/ecwid-shopping-cart/includes/integrations/class-ecwid-integration-wpbakery-composer.php

Ecwid Ecommerce Shopping Cart [ecwid_productbrowser] Shortcode

The Ecwid_Productbrowser shortcode is a functional tool within the Ecwid Shopping Cart plugin in WordPress. It renders product browsing features on your website. This shortcode calls the ‘ecwid_render_shortcode’ function. It takes in parameters and content, returning a shortcode object. This object then renders the product browser feature.

Shortcode: [ecwid_productbrowser]

Examples and Usage

Basic example – The shortcode displays the Ecwid Product Browser on a given page or post.

[ecwid_productbrowser /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'ecwid_productbrowser', 'ecwid_render_shortcode' );

Shortcode PHP function:

function ecwid_render_shortcode( $params, $content = '', $name = '' ) {
	$shortcode = Ecwid_Shortcode_Base::get_shortcode_object( $name, $params );

	if ( $shortcode ) {
		return $shortcode->render( array( 'legacy' => true ) );
	}
}

Code file location:

ecwid-shopping-cart/ecwid-shopping-cart/includes/shortcodes.php

Ecwid Ecommerce Shopping Cart [ecwid_searchbox] Shortcode

The ‘ecwid_searchbox’ shortcode is a part of the Ecwid Shopping Cart plugin. It generates a search box within your online store, allowing users to easily find products.

Shortcode: [ecwid_searchbox]

Examples and Usage

Basic example – An implementation of the Ecwid search box shortcode without any parameters.

[ecwid_searchbox /]

PHP Function Code

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

Shortcode line:

add_shortcode( 'ecwid_searchbox', 'ecwid_searchbox_shortcode' );

Shortcode PHP function:

function ecwid_searchbox_shortcode( $params, $content = '', $name = '' ) {

	$shortcode = new Ecwid_Shortcode_Search( $params );

	return $shortcode->render( array( 'legacy' => true ) );
}

Code file location:

ecwid-shopping-cart/ecwid-shopping-cart/includes/shortcodes.php

Conclusion

Now that you’ve learned how to embed the Ecwid Ecommerce Shopping Cart 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 *