<?php

if ( ! function_exists( 'theaisle_elated_include_woocommerce_shortcodes' ) ) {
	function theaisle_elated_include_woocommerce_shortcodes() {
		foreach ( glob( ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/woocommerce/shortcodes/*/load.php' ) as $shortcode_load ) {
			include_once $shortcode_load;
		}
	}
	
	if ( theaisle_elated_core_plugin_installed() ) {
		add_action( 'theaisle_core_action_include_shortcodes_file', 'theaisle_elated_include_woocommerce_shortcodes' );
	}
}

// Load woo elementor widgets
if ( ! function_exists( 'theaisle_elated_include_woo_elementor_widgets_files' ) ) {
	/**
	 * Loades all shortcodes by going through all folders that are placed directly in shortcodes folder
	 */
	function theaisle_elated_include_woo_elementor_widgets_files() {
		foreach ( glob( ELATED_FRAMEWORK_MODULES_ROOT_DIR . '/woocommerce/shortcodes/*/elementor-*.php' ) as $shortcode_load ) {
			include_once $shortcode_load;
		}
	}
	if ( theaisle_elated_is_elementor_installed() && theaisle_elated_core_plugin_installed() ) {
		add_action('elementor/widgets/widgets_registered', 'theaisle_elated_include_woo_elementor_widgets_files');
	}
}