<?php
/* Woocommerce support functions
------------------------------------------------------------------------------- */

// Theme init
if (!function_exists('healthcoach_woocommerce_theme_setup')) {
	add_action( 'healthcoach_action_before_init_theme', 'healthcoach_woocommerce_theme_setup', 1 );
	function healthcoach_woocommerce_theme_setup() {

		if (healthcoach_exists_woocommerce()) {
			add_action('healthcoach_action_add_styles', 				'healthcoach_woocommerce_frontend_scripts' );

			// Detect current page type, taxonomy and title (for custom post_types use priority < 10 to fire it handles early, than for standard post types)
			add_filter('healthcoach_filter_get_blog_type',				'healthcoach_woocommerce_get_blog_type', 9, 2);
			add_filter('healthcoach_filter_get_blog_title',			'healthcoach_woocommerce_get_blog_title', 9, 2);
			add_filter('healthcoach_filter_get_current_taxonomy',		'healthcoach_woocommerce_get_current_taxonomy', 9, 2);
			add_filter('healthcoach_filter_is_taxonomy',				'healthcoach_woocommerce_is_taxonomy', 9, 2);
			add_filter('healthcoach_filter_get_stream_page_title',		'healthcoach_woocommerce_get_stream_page_title', 9, 2);
			add_filter('healthcoach_filter_get_stream_page_link',		'healthcoach_woocommerce_get_stream_page_link', 9, 2);
			add_filter('healthcoach_filter_get_stream_page_id',		'healthcoach_woocommerce_get_stream_page_id', 9, 2);
			add_filter('healthcoach_filter_detect_inheritance_key',	'healthcoach_woocommerce_detect_inheritance_key', 9, 1);
			add_filter('healthcoach_filter_detect_template_page_id',	'healthcoach_woocommerce_detect_template_page_id', 9, 2);
			add_filter('healthcoach_filter_orderby_need',				'healthcoach_woocommerce_orderby_need', 9, 2);

			add_filter('healthcoach_filter_show_post_navi', 			'healthcoach_woocommerce_show_post_navi');
			add_filter('healthcoach_filter_list_post_types', 			'healthcoach_woocommerce_list_post_types');

			add_action('healthcoach_action_shortcodes_list', 			'healthcoach_woocommerce_reg_shortcodes', 20);
			if (function_exists('healthcoach_exists_visual_composer') && healthcoach_exists_visual_composer())
				add_action('healthcoach_action_shortcodes_list_vc',	'healthcoach_woocommerce_reg_shortcodes_vc', 20);


		}

		if (is_admin()) {
			add_filter( 'healthcoach_filter_importer_required_plugins',		'healthcoach_woocommerce_importer_required_plugins', 10, 2 );
			add_filter( 'healthcoach_filter_required_plugins',					'healthcoach_woocommerce_required_plugins' );
		}
	}
}

if ( !function_exists( 'healthcoach_woocommerce_settings_theme_setup2' ) ) {
	add_action( 'healthcoach_action_before_init_theme', 'healthcoach_woocommerce_settings_theme_setup2', 3 );
	function healthcoach_woocommerce_settings_theme_setup2() {
		if (healthcoach_exists_woocommerce()) {
			// Add WooCommerce pages in the Theme inheritance system
			healthcoach_add_theme_inheritance( array( 'woocommerce' => array(
				'stream_template' => 'blog-woocommerce',		// This params must be empty
				'single_template' => 'single-woocommerce',		// They are specified to enable separate settings for blog and single wooc
				'taxonomy' => array('product_cat'),
				'taxonomy_tags' => array('product_tag'),
				'post_type' => array('product'),
				'override' => 'custom'
				) )
			);

			// Add WooCommerce specific options in the Theme Options

			healthcoach_storage_set_array_before('options', 'partition_service', array(
				
				"partition_woocommerce" => array(
					"title" => esc_html__('WooCommerce', 'healthcoach'),
					"icon" => "iconadmin-basket",
					"type" => "partition"),

				"info_wooc_1" => array(
					"title" => esc_html__('WooCommerce products list parameters', 'healthcoach'),
					"desc" => esc_html__("Select WooCommerce products list's style and crop parameters", 'healthcoach'),
					"type" => "info"),
		
				"shop_mode" => array(
					"title" => esc_html__('Shop list style',  'healthcoach'),
					"desc" => esc_html__("WooCommerce products list's style: thumbs or list with description", 'healthcoach'),
					"std" => "thumbs",
					"divider" => false,
					"options" => array(
						'thumbs' => esc_html__('Thumbs', 'healthcoach'),
						'list' => esc_html__('List', 'healthcoach')
					),
					"type" => "checklist"),
		
				"show_mode_buttons" => array(
					"title" => esc_html__('Show style buttons',  'healthcoach'),
					"desc" => esc_html__("Show buttons to allow visitors change list style", 'healthcoach'),
					"std" => "yes",
					"options" => healthcoach_get_options_param('list_yes_no'),
					"type" => "switch"),

				"shop_loop_columns" => array(
					"title" => esc_html__('Shop columns',  'healthcoach'),
					"desc" => esc_html__("How many columns used to show products on shop page", 'healthcoach'),
					"std" => "3",
					"step" => 1,
					"min" => 1,
					"max" => 6,
					"type" => "spinner"),

				"show_currency" => array(
					"title" => esc_html__('Show currency selector', 'healthcoach'),
					"desc" => esc_html__('Show currency selector in the user menu', 'healthcoach'),
					"std" => "yes",
					"options" => healthcoach_get_options_param('list_yes_no'),
					"type" => "hidden"),
		
				"show_cart" => array(
					"title" => esc_html__('Show cart button', 'healthcoach'),
					"desc" => esc_html__('Show cart button in the user menu', 'healthcoach'),
					"std" => "shop",
					"options" => array(
						'hide'   => esc_html__('Hide', 'healthcoach'),
						'always' => esc_html__('Always', 'healthcoach'),
						'shop'   => esc_html__('Only on shop pages', 'healthcoach')
					),
					"type" => "hidden"),

				"crop_product_thumb" => array(
					"title" => esc_html__("Crop product's thumbnail",  'healthcoach'),
					"desc" => esc_html__("Crop product's thumbnails on search results page or scale it", 'healthcoach'),
					"std" => "no",
					"options" => healthcoach_get_options_param('list_yes_no'),
					"type" => "switch")
				
				)
			);

		}
	}
}

// WooCommerce hooks
if (!function_exists('healthcoach_woocommerce_theme_setup3')) {
	add_action( 'healthcoach_action_after_init_theme', 'healthcoach_woocommerce_theme_setup3' );
	function healthcoach_woocommerce_theme_setup3() {

		if (healthcoach_exists_woocommerce()) {

			add_action(    'woocommerce_before_subcategory_title',		'healthcoach_woocommerce_open_thumb_wrapper', 9 );
			add_action(    'woocommerce_before_shop_loop_item_title',	'healthcoach_woocommerce_open_thumb_wrapper', 9 );

			add_action(    'woocommerce_before_subcategory_title',		'healthcoach_woocommerce_open_item_wrapper', 20 );
			add_action(    'woocommerce_before_shop_loop_item_title',	'healthcoach_woocommerce_open_item_wrapper', 20 );

			add_action(    'woocommerce_after_subcategory',				'healthcoach_woocommerce_close_item_wrapper', 20 );
			add_action(    'woocommerce_after_shop_loop_item',			'healthcoach_woocommerce_close_item_wrapper', 20 );

			add_action(    'woocommerce_after_shop_loop_item_title',	'healthcoach_woocommerce_after_shop_loop_item_title', 7);

			add_action(    'woocommerce_after_subcategory_title',		'healthcoach_woocommerce_after_subcategory_title', 10 );

			// Remove link around product item
			remove_action('woocommerce_before_shop_loop_item',			'woocommerce_template_loop_product_link_open', 10);
			remove_action('woocommerce_after_shop_loop_item',			'woocommerce_template_loop_product_link_close', 5);
			// Remove link around product category
			remove_action('woocommerce_before_subcategory',				'woocommerce_template_loop_category_link_open', 10);
			remove_action('woocommerce_after_subcategory',				'woocommerce_template_loop_category_link_close', 10);

		}

		if (healthcoach_is_woocommerce_page()) {
			
			remove_action( 'woocommerce_sidebar', 						'woocommerce_get_sidebar', 10 );					// Remove WOOC sidebar
			
			remove_action( 'woocommerce_before_main_content',			'woocommerce_output_content_wrapper', 10);
			add_action(    'woocommerce_before_main_content',			'healthcoach_woocommerce_wrapper_start', 10);
			
			remove_action( 'woocommerce_after_main_content',			'woocommerce_output_content_wrapper_end', 10);		
			add_action(    'woocommerce_after_main_content',			'healthcoach_woocommerce_wrapper_end', 10);

			add_action(    'woocommerce_show_page_title',				'healthcoach_woocommerce_show_page_title', 10);

			remove_action( 'woocommerce_single_product_summary',		'woocommerce_template_single_title', 5);		
			add_action(    'woocommerce_single_product_summary',		'healthcoach_woocommerce_show_product_title', 5 );

			add_action(    'woocommerce_before_shop_loop', 				'healthcoach_woocommerce_before_shop_loop', 10 );

			remove_action( 'woocommerce_after_shop_loop',				'woocommerce_pagination', 10 );
			add_action(    'woocommerce_after_shop_loop',				'healthcoach_woocommerce_pagination', 10 );

			add_action(    'woocommerce_product_meta_end',				'healthcoach_woocommerce_show_product_id', 10);

			add_filter(    'woocommerce_output_related_products_args',	'healthcoach_woocommerce_output_related_products_args' );
			
			add_filter(    'woocommerce_product_thumbnails_columns',	'healthcoach_woocommerce_product_thumbnails_columns' );

			

			add_filter(    'get_product_search_form',					'healthcoach_woocommerce_get_product_search_form' );

			add_filter(    'post_class',								'healthcoach_woocommerce_loop_shop_columns_class' );
			add_action(    'the_title',									'healthcoach_woocommerce_the_title');
			
			healthcoach_enqueue_popup();
		}
	}
}



// Check if WooCommerce installed and activated
if ( !function_exists( 'healthcoach_exists_woocommerce' ) ) {
	function healthcoach_exists_woocommerce() {
		return class_exists('Woocommerce');
	}
}

// Return true, if current page is any woocommerce page
if ( !function_exists( 'healthcoach_is_woocommerce_page' ) ) {
	function healthcoach_is_woocommerce_page() {
		$rez = false;
		if (healthcoach_exists_woocommerce()) {
			if (!healthcoach_storage_empty('pre_query')) {
				$id = healthcoach_storage_get_obj_property('pre_query', 'queried_object_id', 0);
				$rez = healthcoach_storage_call_obj_method('pre_query', 'get', 'post_type')=='product' 
						|| $id==wc_get_page_id('shop')
						|| $id==wc_get_page_id('cart')
						|| $id==wc_get_page_id('checkout')
						|| $id==wc_get_page_id('myaccount')
						|| healthcoach_storage_call_obj_method('pre_query', 'is_tax', 'product_cat')
						|| healthcoach_storage_call_obj_method('pre_query', 'is_tax', 'product_tag')
						|| healthcoach_storage_call_obj_method('pre_query', 'is_tax', get_object_taxonomies('product'));
						
			} else
				$rez = is_shop() || is_product() || is_product_category() || is_product_tag() || is_product_taxonomy() || is_cart() || is_checkout() || is_account_page();
		}
		return $rez;
	}
}

// Filter to detect current page inheritance key
if ( !function_exists( 'healthcoach_woocommerce_detect_inheritance_key' ) ) {
	
	function healthcoach_woocommerce_detect_inheritance_key($key) {
		if (!empty($key)) return $key;
		return healthcoach_is_woocommerce_page() ? 'woocommerce' : '';
	}
}

// Filter to detect current template page id
if ( !function_exists( 'healthcoach_woocommerce_detect_template_page_id' ) ) {
	
	function healthcoach_woocommerce_detect_template_page_id($id, $key) {
		if (!empty($id)) return $id;
		if ($key == 'woocommerce_cart')				$id = get_option('woocommerce_cart_page_id');
		else if ($key == 'woocommerce_checkout')	$id = get_option('woocommerce_checkout_page_id');
		else if ($key == 'woocommerce_account')		$id = get_option('woocommerce_account_page_id');
		else if ($key == 'woocommerce')				$id = get_option('woocommerce_shop_page_id');
		return $id;
	}
}

// Filter to detect current page type (slug)
if ( !function_exists( 'healthcoach_woocommerce_get_blog_type' ) ) {
	
	function healthcoach_woocommerce_get_blog_type($page, $query=null) {
		if (!empty($page)) return $page;
		
		if (is_shop()) 					$page = 'woocommerce_shop';
		else if ($query && $query->get('post_type')=='product' || is_product())		$page = 'woocommerce_product';
		else if ($query && $query->get('product_tag')!='' || is_product_tag())		$page = 'woocommerce_tag';
		else if ($query && $query->get('product_cat')!='' || is_product_category())	$page = 'woocommerce_category';
		else if (is_cart())				$page = 'woocommerce_cart';
		else if (is_checkout())			$page = 'woocommerce_checkout';
		else if (is_account_page())		$page = 'woocommerce_account';
		else if (is_woocommerce())		$page = 'woocommerce';
		return $page;
	}
}

// Filter to detect current page title
if ( !function_exists( 'healthcoach_woocommerce_get_blog_title' ) ) {
	
	function healthcoach_woocommerce_get_blog_title($title, $page) {
		if (!empty($title)) return $title;
		
		if ( healthcoach_strpos($page, 'woocommerce')!==false ) {
			if ( $page == 'woocommerce_category' ) {
				$term = get_term_by( 'slug', get_query_var( 'product_cat' ), 'product_cat', OBJECT);
				$title = $term->name;
			} else if ( $page == 'woocommerce_tag' ) {
				$term = get_term_by( 'slug', get_query_var( 'product_tag' ), 'product_tag', OBJECT);
				$title = esc_html__('Tag:', 'healthcoach') . ' ' . esc_html($term->name);
			} else if ( $page == 'woocommerce_cart' ) {
				$title = esc_html__( 'Your cart', 'healthcoach' );
			} else if ( $page == 'woocommerce_checkout' ) {
				$title = esc_html__( 'Checkout', 'healthcoach' );
			} else if ( $page == 'woocommerce_account' ) {
				$title = esc_html__( 'Account', 'healthcoach' );
			} else if ( $page == 'woocommerce_product' ) {
				$title = healthcoach_get_post_title();
			} else if (($page_id=get_option('woocommerce_shop_page_id')) > 0) {
				$title = healthcoach_get_post_title($page_id);
			} else {
				$title = esc_html__( 'Shop', 'healthcoach' );
			}
		}
		
		return $title;
	}
}

// Filter to detect stream page title
if ( !function_exists( 'healthcoach_woocommerce_get_stream_page_title' ) ) {
	
	function healthcoach_woocommerce_get_stream_page_title($title, $page) {
		if (!empty($title)) return $title;
		if (healthcoach_strpos($page, 'woocommerce')!==false) {
			if (($page_id = healthcoach_woocommerce_get_stream_page_id(0, $page)) > 0)
				$title = healthcoach_get_post_title($page_id);
			else
				$title = esc_html__('Shop', 'healthcoach');				
		}
		return $title;
	}
}

// Filter to detect stream page ID
if ( !function_exists( 'healthcoach_woocommerce_get_stream_page_id' ) ) {
	
	function healthcoach_woocommerce_get_stream_page_id($id, $page) {
		if (!empty($id)) return $id;
		if (healthcoach_strpos($page, 'woocommerce')!==false) {
			$id = get_option('woocommerce_shop_page_id');
		}
		return $id;
	}
}

// Filter to detect stream page link
if ( !function_exists( 'healthcoach_woocommerce_get_stream_page_link' ) ) {
	
	function healthcoach_woocommerce_get_stream_page_link($url, $page) {
		if (!empty($url)) return $url;
		if (healthcoach_strpos($page, 'woocommerce')!==false) {
			$id = healthcoach_woocommerce_get_stream_page_id(0, $page);
			if ($id) $url = get_permalink($id);
		}
		return $url;
	}
}

// Filter to detect current taxonomy
if ( !function_exists( 'healthcoach_woocommerce_get_current_taxonomy' ) ) {
	
	function healthcoach_woocommerce_get_current_taxonomy($tax, $page) {
		if (!empty($tax)) return $tax;
		if ( healthcoach_strpos($page, 'woocommerce')!==false ) {
			$tax = 'product_cat';
		}
		return $tax;
	}
}

// Return taxonomy name (slug) if current page is this taxonomy page
if ( !function_exists( 'healthcoach_woocommerce_is_taxonomy' ) ) {
	
	function healthcoach_woocommerce_is_taxonomy($tax, $query=null) {
		if (!empty($tax))
			return $tax;
		else 
			return $query!==null && $query->get('product_cat')!='' || is_product_category() ? 'product_cat' : '';
	}
}

// Return false if current plugin not need theme orderby setting
if ( !function_exists( 'healthcoach_woocommerce_orderby_need' ) ) {
	
	function healthcoach_woocommerce_orderby_need($need) {
		if ($need == false || healthcoach_storage_empty('pre_query'))
			return $need;
		else {
			return healthcoach_storage_call_obj_method('pre_query', 'get', 'post_type')!='product' 
					&& healthcoach_storage_call_obj_method('pre_query', 'get', 'product_cat')==''
					&& healthcoach_storage_call_obj_method('pre_query', 'get', 'product_tag')=='';
		}
	}
}

// Add custom post type into list
if ( !function_exists( 'healthcoach_woocommerce_list_post_types' ) ) {
	
	function healthcoach_woocommerce_list_post_types($list) {
		$list['product'] = esc_html__('Products', 'healthcoach');
		return $list;
	}
}


	
// Enqueue WooCommerce custom styles
if ( !function_exists( 'healthcoach_woocommerce_frontend_scripts' ) ) {
	
	function healthcoach_woocommerce_frontend_scripts() {
			if (file_exists(healthcoach_get_file_dir('css/plugin.woocommerce.css')))
				wp_enqueue_style( 'healthcoach-plugin-woocommerce-style',  healthcoach_get_file_url('css/plugin.woocommerce.css'), array(), null );
	}
}

// Before main content
if ( !function_exists( 'healthcoach_woocommerce_wrapper_start' ) ) {
	
	
	function healthcoach_woocommerce_wrapper_start() {
		if (is_product() || is_cart() || is_checkout() || is_account_page()) {
			?>
			<article class="post_item post_item_single post_item_product">
			<?php
		} else {
			?>
			<div class="list_products shop_mode_<?php echo !healthcoach_storage_empty('shop_mode') ? healthcoach_storage_get('shop_mode') : 'thumbs'; ?>">
			<?php
		}
	}
}

// After main content
if ( !function_exists( 'healthcoach_woocommerce_wrapper_end' ) ) {
	
	
	function healthcoach_woocommerce_wrapper_end() {
		if (is_product() || is_cart() || is_checkout() || is_account_page()) {
			?>
			</article>	<!-- .post_item -->
			<?php
		} else {
			?>
			</div>	<!-- .list_products -->
			<?php
		}
	}
}

// Check to show page title
if ( !function_exists( 'healthcoach_woocommerce_show_page_title' ) ) {
	
	function healthcoach_woocommerce_show_page_title($defa=true) {
		return healthcoach_get_custom_option('show_page_title')=='no';
	}
}

// Check to show product title
if ( !function_exists( 'healthcoach_woocommerce_show_product_title' ) ) {
	
	
	function healthcoach_woocommerce_show_product_title() {
		if (healthcoach_get_custom_option('show_post_title')=='yes' || healthcoach_get_custom_option('show_page_title')=='no') {
			wc_get_template( 'single-product/title.php' );
		}
	}
}

// Add list mode buttons
if ( !function_exists( 'healthcoach_woocommerce_before_shop_loop' ) ) {
	
	function healthcoach_woocommerce_before_shop_loop() {
		if (healthcoach_get_custom_option('show_mode_buttons')=='yes') {
			echo '<div class="mode_buttons"><form action="' . esc_url(healthcoach_get_current_url()) . '" method="post">'
				. '<input type="hidden" name="healthcoach_shop_mode" value="'.esc_attr(healthcoach_storage_get('shop_mode')).'" />'
				. '<a href="#" class="woocommerce_thumbs icon-th" title="'.esc_attr__('Show products as thumbs', 'healthcoach').'"></a>'
				. '<a href="#" class="woocommerce_list icon-th-list" title="'.esc_attr__('Show products as list', 'healthcoach').'"></a>'
				. '</form></div>';
		}
	}
}


// Open thumbs wrapper for categories and products
if ( !function_exists( 'healthcoach_woocommerce_open_thumb_wrapper' ) ) {
	
	
	function healthcoach_woocommerce_open_thumb_wrapper($cat='') {
		healthcoach_storage_set('in_product_item', true);
		?>
		<div class="post_item_wrap">
			<div class="post_featured">
				<div class="post_thumb">
					<a class="hover_icon hover_icon_link" href="<?php echo esc_url(is_object($cat) ? get_term_link($cat->slug, 'product_cat') : get_permalink()); ?>">
		<?php
	}
}

// Open item wrapper for categories and products
if ( !function_exists( 'healthcoach_woocommerce_open_item_wrapper' ) ) {
	
	
	function healthcoach_woocommerce_open_item_wrapper($cat='') {
		?>
				</a>
			</div>
		</div>
		<div class="post_content">
		<?php
	}
}

// Close item wrapper for categories and products
if ( !function_exists( 'healthcoach_woocommerce_close_item_wrapper' ) ) {
	
	
	function healthcoach_woocommerce_close_item_wrapper($cat='') {
		?>
			</div>
		</div>
		<?php
		healthcoach_storage_set('in_product_item', false);
	}
}

// Add excerpt in output for the product in the list mode
if ( !function_exists( 'healthcoach_woocommerce_after_shop_loop_item_title' ) ) {
	
	function healthcoach_woocommerce_after_shop_loop_item_title() {
		if (healthcoach_storage_get('shop_mode') == 'list') {
		    $excerpt = apply_filters('the_excerpt', get_the_excerpt());
			echo '<div class="description">'.trim($excerpt).'</div>';
		}
	}
}

// Add excerpt in output for the product in the list mode
if ( !function_exists( 'healthcoach_woocommerce_after_subcategory_title' ) ) {
	
	function healthcoach_woocommerce_after_subcategory_title($category) {
		if (healthcoach_storage_get('shop_mode') == 'list')
			echo '<div class="description">' . trim($category->description) . '</div>';
	}
}

// Add Product ID for single product
if ( !function_exists( 'healthcoach_woocommerce_show_product_id' ) ) {
	
	function healthcoach_woocommerce_show_product_id() {
		global $post, $product;
		echo '<span class="product_id">'.esc_html__('Product ID: ', 'healthcoach') . '<span>' . ($post->ID) . '</span></span>';
	}
}

// Redefine number of related products
if ( !function_exists( 'healthcoach_woocommerce_output_related_products_args' ) ) {
	
	function healthcoach_woocommerce_output_related_products_args($args) {
		$ppp = $ccc = 0;
		if (healthcoach_param_is_on(healthcoach_get_custom_option('show_post_related'))) {
			$ccc_add = in_array(healthcoach_get_custom_option('body_style'), array('fullwide', 'fullscreen')) ? 1 : 0;
			$ccc =  healthcoach_get_custom_option('post_related_columns');
			$ccc = $ccc > 0 ? $ccc : (healthcoach_param_is_off(healthcoach_get_custom_option('show_sidebar_main')) ? 3+$ccc_add : 2+$ccc_add);
			$ppp = healthcoach_get_custom_option('post_related_count');
			$ppp = $ppp > 0 ? $ppp : $ccc;
		}
		$args['posts_per_page'] = $ppp;
		$args['columns'] = $ccc;
		return $args;
	}
}

// Number columns for product thumbnails
if ( !function_exists( 'healthcoach_woocommerce_product_thumbnails_columns' ) ) {
	
	function healthcoach_woocommerce_product_thumbnails_columns($cols) {
		return 4;
	}
}



// Add column class into product item in shop streampage
if ( !function_exists( 'healthcoach_woocommerce_loop_shop_columns_class' ) ) {
    
    function healthcoach_woocommerce_loop_shop_columns_class($class, $class2='', $cat='') {
        if (!is_product() && !is_cart() && !is_checkout() && !is_account_page()) {
            $cols = function_exists('wc_get_default_products_per_row') ? wc_get_default_products_per_row() : 2;
            $class[] = ' column-1_' . $cols;
        }
        return $class;
     }
}



// Search form
if ( !function_exists( 'healthcoach_woocommerce_get_product_search_form' ) ) {
	
	function healthcoach_woocommerce_get_product_search_form($form) {
		return '
		<form role="search" method="get" class="search_form" action="' . esc_url(home_url('/')) . '">
			<input type="text" class="search_field" placeholder="' . esc_attr__('Search for products &hellip;', 'healthcoach') . '" value="' . get_search_query() . '" name="s" title="' . esc_attr__('Search for products:', 'healthcoach') . '" /><button class="search_button icon-search" type="submit"></button>
			<input type="hidden" name="post_type" value="product" />
		</form>
		';
	}
}

// Wrap product title into link
if ( !function_exists( 'healthcoach_woocommerce_the_title' ) ) {
	
	function healthcoach_woocommerce_the_title($title) {
		if (healthcoach_storage_get('in_product_item') && get_post_type()=='product') {
			$title = '<a href="'.esc_url(get_permalink()).'">'.($title).'</a>';
		}
		return $title;
	}
}

// Show pagination links
if ( !function_exists( 'healthcoach_woocommerce_pagination' ) ) {
	
	function healthcoach_woocommerce_pagination() {
		$style = healthcoach_get_custom_option('blog_pagination');
		healthcoach_show_pagination(array(
			'class' => 'pagination_wrap pagination_' . esc_attr($style),
			'style' => $style,
			'button_class' => '',
			'first_text'=> '',
			'last_text' => '',
			'prev_text' => '',
			'next_text' => '',
			'pages_in_group' => $style=='pages' ? 10 : 20
			)
		);
	}
}

// Filter to add in the required plugins list
if ( !function_exists( 'healthcoach_woocommerce_required_plugins' ) ) {
	
	function healthcoach_woocommerce_required_plugins($list=array()) {
		if (in_array('woocommerce', healthcoach_storage_get('required_plugins')))
			$list[] = array(
					'name' 		=> 'WooCommerce',
					'slug' 		=> 'woocommerce',
					'required' 	=> false
				);

		return $list;
	}
}

// Show products navigation
if ( !function_exists( 'healthcoach_woocommerce_show_post_navi' ) ) {
	
	function healthcoach_woocommerce_show_post_navi($show=false) {
		return $show || (healthcoach_get_custom_option('show_page_title')=='yes' && is_single() && healthcoach_is_woocommerce_page());
	}
}



// One-click import support
//------------------------------------------------------------------------

// Check WooC in the required plugins
if ( !function_exists( 'healthcoach_woocommerce_importer_required_plugins' ) ) {
	
	function healthcoach_woocommerce_importer_required_plugins($not_installed='', $list='') {
		if (healthcoach_strpos($list, 'woocommerce')!==false && !healthcoach_exists_woocommerce() )
			$not_installed .= '<br>' . esc_html__('WooCommerce', 'healthcoach');
		return $not_installed;
	}
}


if ( ! function_exists( 'healthcoach_woocommerce_price_filter_widget_step' ) ) {
    add_filter('woocommerce_price_filter_widget_step', 'healthcoach_woocommerce_price_filter_widget_step');
    function healthcoach_woocommerce_price_filter_widget_step( $step = '' ) {
        $step = 1;
        return $step;
    }
}


// Register shortcodes to the internal builder
//------------------------------------------------------------------------
if ( !function_exists( 'healthcoach_woocommerce_reg_shortcodes' ) ) {
	
	function healthcoach_woocommerce_reg_shortcodes() {

		// WooCommerce - Cart
		healthcoach_sc_map("woocommerce_cart", array(
			"title" => esc_html__("Woocommerce: Cart", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show Cart page", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array()
			)
		);
		
		// WooCommerce - Checkout
		healthcoach_sc_map("woocommerce_checkout", array(
			"title" => esc_html__("Woocommerce: Checkout", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show Checkout page", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array()
			)
		);
		
		// WooCommerce - My Account
		healthcoach_sc_map("woocommerce_my_account", array(
			"title" => esc_html__("Woocommerce: My Account", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show My Account page", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array()
			)
		);
		
		// WooCommerce - Order Tracking
		healthcoach_sc_map("woocommerce_order_tracking", array(
			"title" => esc_html__("Woocommerce: Order Tracking", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show Order Tracking page", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array()
			)
		);
		
		// WooCommerce - Shop Messages
		healthcoach_sc_map("shop_messages", array(
			"title" => esc_html__("Woocommerce: Shop Messages", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show shop messages", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array()
			)
		);
		
		// WooCommerce - Product Page
		healthcoach_sc_map("product_page", array(
			"title" => esc_html__("Woocommerce: Product Page", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: display single product page", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"sku" => array(
					"title" => esc_html__("SKU", 'healthcoach'),
					"desc" => wp_kses_data( __("SKU code of displayed product", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"id" => array(
					"title" => esc_html__("ID", 'healthcoach'),
					"desc" => wp_kses_data( __("ID of displayed product", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"posts_per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => "1",
					"min" => 1,
					"type" => "spinner"
				),
				"post_type" => array(
					"title" => esc_html__("Post type", 'healthcoach'),
					"desc" => wp_kses_data( __("Post type for the WP query (leave 'product')", 'healthcoach') ),
					"value" => "product",
					"type" => "text"
				),
				"post_status" => array(
					"title" => esc_html__("Post status", 'healthcoach'),
					"desc" => wp_kses_data( __("Display posts only with this status", 'healthcoach') ),
					"value" => "publish",
					"type" => "select",
					"options" => array(
						"publish" => esc_html__('Publish', 'healthcoach'),
						"protected" => esc_html__('Protected', 'healthcoach'),
						"private" => esc_html__('Private', 'healthcoach'),
						"pending" => esc_html__('Pending', 'healthcoach'),
						"draft" => esc_html__('Draft', 'healthcoach')
						)
					)
				)
			)
		);
		
		// WooCommerce - Product
		healthcoach_sc_map("product", array(
			"title" => esc_html__("Woocommerce: Product", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: display one product", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"sku" => array(
					"title" => esc_html__("SKU", 'healthcoach'),
					"desc" => wp_kses_data( __("SKU code of displayed product", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"id" => array(
					"title" => esc_html__("ID", 'healthcoach'),
					"desc" => wp_kses_data( __("ID of displayed product", 'healthcoach') ),
					"value" => "",
					"type" => "text"
					)
				)
			)
		);
		
		// WooCommerce - Best Selling Products
		healthcoach_sc_map("best_selling_products", array(
			"title" => esc_html__("Woocommerce: Best Selling Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show best selling products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
					)
				)
			)
		);
		
		// WooCommerce - Recent Products
		healthcoach_sc_map("recent_products", array(
			"title" => esc_html__("Woocommerce: Recent Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show recent products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
					)
				)
			)
		);
		
		// WooCommerce - Related Products
		healthcoach_sc_map("related_products", array(
			"title" => esc_html__("Woocommerce: Related Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show related products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"posts_per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
						)
					)
				)
			)
		);
		
		// WooCommerce - Featured Products
		healthcoach_sc_map("featured_products", array(
			"title" => esc_html__("Woocommerce: Featured Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show featured products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
					)
				)
			)
		);
		
		// WooCommerce - Top Rated Products
		healthcoach_sc_map("featured_products", array(
			"title" => esc_html__("Woocommerce: Top Rated Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show top rated products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
					)
				)
			)
		);
		
		// WooCommerce - Sale Products
		healthcoach_sc_map("featured_products", array(
			"title" => esc_html__("Woocommerce: Sale Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: list products on sale", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
					)
				)
			)
		);
		
		// WooCommerce - Product Category
		healthcoach_sc_map("product_category", array(
			"title" => esc_html__("Woocommerce: Products from category", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: list products in specified category(-ies)", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
				),
				"category" => array(
					"title" => esc_html__("Categories", 'healthcoach'),
					"desc" => wp_kses_data( __("Comma separated category slugs", 'healthcoach') ),
					"value" => '',
					"type" => "text"
				),
				"operator" => array(
					"title" => esc_html__("Operator", 'healthcoach'),
					"desc" => wp_kses_data( __("Categories operator", 'healthcoach') ),
					"value" => "IN",
					"type" => "checklist",
					"size" => "medium",
					"options" => array(
						"IN" => esc_html__('IN', 'healthcoach'),
						"NOT IN" => esc_html__('NOT IN', 'healthcoach'),
						"AND" => esc_html__('AND', 'healthcoach')
						)
					)
				)
			)
		);
		
		// WooCommerce - Products
		healthcoach_sc_map("products", array(
			"title" => esc_html__("Woocommerce: Products", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: list all products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"skus" => array(
					"title" => esc_html__("SKUs", 'healthcoach'),
					"desc" => wp_kses_data( __("Comma separated SKU codes of products", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"ids" => array(
					"title" => esc_html__("IDs", 'healthcoach'),
					"desc" => wp_kses_data( __("Comma separated ID of products", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
					)
				)
			)
		);
		
		// WooCommerce - Product attribute
		healthcoach_sc_map("product_attribute", array(
			"title" => esc_html__("Woocommerce: Products by Attribute", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show products with specified attribute", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"per_page" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many products showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
				),
				"attribute" => array(
					"title" => esc_html__("Attribute", 'healthcoach'),
					"desc" => wp_kses_data( __("Attribute name", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"filter" => array(
					"title" => esc_html__("Filter", 'healthcoach'),
					"desc" => wp_kses_data( __("Attribute value", 'healthcoach') ),
					"value" => "",
					"type" => "text"
					)
				)
			)
		);
		
		// WooCommerce - Products Categories
		healthcoach_sc_map("product_categories", array(
			"title" => esc_html__("Woocommerce: Product Categories", 'healthcoach'),
			"desc" => wp_kses_data( __("WooCommerce shortcode: show categories with products", 'healthcoach') ),
			"decorate" => false,
			"container" => false,
			"params" => array(
				"number" => array(
					"title" => esc_html__("Number", 'healthcoach'),
					"desc" => wp_kses_data( __("How many categories showed", 'healthcoach') ),
					"value" => 4,
					"min" => 1,
					"type" => "spinner"
				),
				"columns" => array(
					"title" => esc_html__("Columns", 'healthcoach'),
					"desc" => wp_kses_data( __("How many columns per row use for categories output", 'healthcoach') ),
					"value" => 4,
					"min" => 2,
					"max" => 4,
					"type" => "spinner"
				),
				"orderby" => array(
					"title" => esc_html__("Order by", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "date",
					"type" => "select",
					"options" => array(
						"date" => esc_html__('Date', 'healthcoach'),
						"title" => esc_html__('Title', 'healthcoach')
					)
				),
				"order" => array(
					"title" => esc_html__("Order", 'healthcoach'),
					"desc" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
					"value" => "desc",
					"type" => "switch",
					"size" => "big",
					"options" => healthcoach_get_sc_param('ordering')
				),
				"parent" => array(
					"title" => esc_html__("Parent", 'healthcoach'),
					"desc" => wp_kses_data( __("Parent category slug", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"ids" => array(
					"title" => esc_html__("IDs", 'healthcoach'),
					"desc" => wp_kses_data( __("Comma separated ID of products", 'healthcoach') ),
					"value" => "",
					"type" => "text"
				),
				"hide_empty" => array(
					"title" => esc_html__("Hide empty", 'healthcoach'),
					"desc" => wp_kses_data( __("Hide empty categories", 'healthcoach') ),
					"value" => "yes",
					"type" => "switch",
					"options" => healthcoach_get_sc_param('yes_no')
					)
				)
			)
		);
	}
}



// Register shortcodes to the VC builder
//------------------------------------------------------------------------
if ( !function_exists( 'healthcoach_woocommerce_reg_shortcodes_vc' ) ) {
	
	function healthcoach_woocommerce_reg_shortcodes_vc() {
	
		if (false && function_exists('healthcoach_exists_woocommerce') && healthcoach_exists_woocommerce()) {
		
			// WooCommerce - Cart
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "woocommerce_cart",
				"name" => esc_html__("Cart", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show cart page", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_wooc_cart',
				"class" => "trx_sc_alone trx_sc_woocommerce_cart",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => false,
				"params" => array(
					array(
						"param_name" => "dummy",
						"heading" => esc_html__("Dummy data", 'healthcoach'),
						"description" => wp_kses_data( __("Dummy data - not used in shortcodes", 'healthcoach') ),
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Woocommerce_Cart extends Healthcoach_VC_ShortCodeAlone {}
		
		
			// WooCommerce - Checkout
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "woocommerce_checkout",
				"name" => esc_html__("Checkout", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show checkout page", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_wooc_checkout',
				"class" => "trx_sc_alone trx_sc_woocommerce_checkout",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => false,
				"params" => array(
					array(
						"param_name" => "dummy",
						"heading" => esc_html__("Dummy data", 'healthcoach'),
						"description" => wp_kses_data( __("Dummy data - not used in shortcodes", 'healthcoach') ),
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Woocommerce_Checkout extends Healthcoach_VC_ShortCodeAlone {}
		
		
			// WooCommerce - My Account
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "woocommerce_my_account",
				"name" => esc_html__("My Account", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show my account page", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_wooc_my_account',
				"class" => "trx_sc_alone trx_sc_woocommerce_my_account",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => false,
				"params" => array(
					array(
						"param_name" => "dummy",
						"heading" => esc_html__("Dummy data", 'healthcoach'),
						"description" => wp_kses_data( __("Dummy data - not used in shortcodes", 'healthcoach') ),
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Woocommerce_My_Account extends Healthcoach_VC_ShortCodeAlone {}
		
		
			// WooCommerce - Order Tracking
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "woocommerce_order_tracking",
				"name" => esc_html__("Order Tracking", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show order tracking page", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_wooc_order_tracking',
				"class" => "trx_sc_alone trx_sc_woocommerce_order_tracking",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => false,
				"params" => array(
					array(
						"param_name" => "dummy",
						"heading" => esc_html__("Dummy data", 'healthcoach'),
						"description" => wp_kses_data( __("Dummy data - not used in shortcodes", 'healthcoach') ),
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Woocommerce_Order_Tracking extends Healthcoach_VC_ShortCodeAlone {}
		
		
			// WooCommerce - Shop Messages
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "shop_messages",
				"name" => esc_html__("Shop Messages", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show shop messages", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_wooc_shop_messages',
				"class" => "trx_sc_alone trx_sc_shop_messages",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => false,
				"params" => array(
					array(
						"param_name" => "dummy",
						"heading" => esc_html__("Dummy data", 'healthcoach'),
						"description" => wp_kses_data( __("Dummy data - not used in shortcodes", 'healthcoach') ),
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Shop_Messages extends Healthcoach_VC_ShortCodeAlone {}
		
		
			// WooCommerce - Product Page
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "product_page",
				"name" => esc_html__("Product Page", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: display single product page", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_product_page',
				"class" => "trx_sc_single trx_sc_product_page",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "sku",
						"heading" => esc_html__("SKU", 'healthcoach'),
						"description" => wp_kses_data( __("SKU code of displayed product", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "id",
						"heading" => esc_html__("ID", 'healthcoach'),
						"description" => wp_kses_data( __("ID of displayed product", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "posts_per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "post_type",
						"heading" => esc_html__("Post type", 'healthcoach'),
						"description" => wp_kses_data( __("Post type for the WP query (leave 'product')", 'healthcoach') ),
						"class" => "",
						"value" => "product",
						"type" => "textfield"
					),
					array(
						"param_name" => "post_status",
						"heading" => esc_html__("Post status", 'healthcoach'),
						"description" => wp_kses_data( __("Display posts only with this status", 'healthcoach') ),
						"class" => "",
						"value" => array(
							esc_html__('Publish', 'healthcoach') => 'publish',
							esc_html__('Protected', 'healthcoach') => 'protected',
							esc_html__('Private', 'healthcoach') => 'private',
							esc_html__('Pending', 'healthcoach') => 'pending',
							esc_html__('Draft', 'healthcoach') => 'draft'
						),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Product_Page extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Product
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "product",
				"name" => esc_html__("Product", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: display one product", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_product',
				"class" => "trx_sc_single trx_sc_product",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "sku",
						"heading" => esc_html__("SKU", 'healthcoach'),
						"description" => wp_kses_data( __("Product's SKU code", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "id",
						"heading" => esc_html__("ID", 'healthcoach'),
						"description" => wp_kses_data( __("Product's ID", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Product extends Healthcoach_VC_ShortCodeSingle {}
		
		
			// WooCommerce - Best Selling Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "best_selling_products",
				"name" => esc_html__("Best Selling Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show best selling products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_best_selling_products',
				"class" => "trx_sc_single trx_sc_best_selling_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Best_Selling_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Recent Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "recent_products",
				"name" => esc_html__("Recent Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show recent products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_recent_products',
				"class" => "trx_sc_single trx_sc_recent_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"

					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Recent_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Related Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "related_products",
				"name" => esc_html__("Related Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show related products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_related_products',
				"class" => "trx_sc_single trx_sc_related_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "posts_per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Related_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Featured Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "featured_products",
				"name" => esc_html__("Featured Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show featured products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_featured_products',
				"class" => "trx_sc_single trx_sc_featured_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Featured_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Top Rated Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "top_rated_products",
				"name" => esc_html__("Top Rated Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show top rated products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_top_rated_products',
				"class" => "trx_sc_single trx_sc_top_rated_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Top_Rated_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Sale Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "sale_products",
				"name" => esc_html__("Sale Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: list products on sale", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_sale_products',
				"class" => "trx_sc_single trx_sc_sale_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Sale_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Product Category
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "product_category",
				"name" => esc_html__("Products from category", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: list products in specified category(-ies)", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_product_category',
				"class" => "trx_sc_single trx_sc_product_category",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					),
					array(
						"param_name" => "category",
						"heading" => esc_html__("Categories", 'healthcoach'),
						"description" => wp_kses_data( __("Comma separated category slugs", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "operator",
						"heading" => esc_html__("Operator", 'healthcoach'),
						"description" => wp_kses_data( __("Categories operator", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('IN', 'healthcoach') => 'IN',
							esc_html__('NOT IN', 'healthcoach') => 'NOT IN',
							esc_html__('AND', 'healthcoach') => 'AND'
						),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Product_Category extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Products
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "products",
				"name" => esc_html__("Products", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: list all products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_products',
				"class" => "trx_sc_single trx_sc_products",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "skus",
						"heading" => esc_html__("SKUs", 'healthcoach'),
						"description" => wp_kses_data( __("Comma separated SKU codes of products", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "ids",
						"heading" => esc_html__("IDs", 'healthcoach'),
						"description" => wp_kses_data( __("Comma separated ID of products", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					)
				)
			) );
			
			class WPBakeryShortCode_Products extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
		
			// WooCommerce - Product Attribute
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "product_attribute",
				"name" => esc_html__("Products by Attribute", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show products with specified attribute", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_product_attribute',
				"class" => "trx_sc_single trx_sc_product_attribute",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "per_page",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many products showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					),
					array(
						"param_name" => "attribute",
						"heading" => esc_html__("Attribute", 'healthcoach'),
						"description" => wp_kses_data( __("Attribute name", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "filter",
						"heading" => esc_html__("Filter", 'healthcoach'),
						"description" => wp_kses_data( __("Attribute value", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					)
				)
			) );
			
			class WPBakeryShortCode_Product_Attribute extends Healthcoach_VC_ShortCodeSingle {}
		
		
		
			// WooCommerce - Products Categories
			//-------------------------------------------------------------------------------------
			
			vc_map( array(
				"base" => "product_categories",
				"name" => esc_html__("Product Categories", 'healthcoach'),
				"description" => wp_kses_data( __("WooCommerce shortcode: show categories with products", 'healthcoach') ),
				"category" => esc_html__('WooCommerce', 'healthcoach'),
				'icon' => 'icon_trx_product_categories',
				"class" => "trx_sc_single trx_sc_product_categories",
				"content_element" => true,
				"is_container" => false,
				"show_settings_on_create" => true,
				"params" => array(
					array(
						"param_name" => "number",
						"heading" => esc_html__("Number", 'healthcoach'),
						"description" => wp_kses_data( __("How many categories showed", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "4",
						"type" => "textfield"
					),
					array(
						"param_name" => "columns",
						"heading" => esc_html__("Columns", 'healthcoach'),
						"description" => wp_kses_data( __("How many columns per row use for categories output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "1",
						"type" => "textfield"
					),
					array(
						"param_name" => "orderby",
						"heading" => esc_html__("Order by", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array(
							esc_html__('Date', 'healthcoach') => 'date',
							esc_html__('Title', 'healthcoach') => 'title'
						),
						"type" => "dropdown"
					),
					array(
						"param_name" => "order",
						"heading" => esc_html__("Order", 'healthcoach'),
						"description" => wp_kses_data( __("Sorting order for products output", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => array_flip(healthcoach_get_sc_param('ordering')),
						"type" => "dropdown"
					),
					array(
						"param_name" => "parent",
						"heading" => esc_html__("Parent", 'healthcoach'),
						"description" => wp_kses_data( __("Parent category slug", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "date",
						"type" => "textfield"
					),
					array(
						"param_name" => "ids",
						"heading" => esc_html__("IDs", 'healthcoach'),
						"description" => wp_kses_data( __("Comma separated ID of products", 'healthcoach') ),
						"admin_label" => true,
						"class" => "",
						"value" => "",
						"type" => "textfield"
					),
					array(
						"param_name" => "hide_empty",
						"heading" => esc_html__("Hide empty", 'healthcoach'),
						"description" => wp_kses_data( __("Hide empty categories", 'healthcoach') ),
						"class" => "",
						"value" => array("Hide empty" => "1" ),
						"type" => "checkbox"
					)
				)
			) );
			
			class WPBakeryShortCode_Products_Categories extends Healthcoach_VC_ShortCodeSingle {}
		
		}
	}
}
?>