diff --git a/sizeme-for-woocommerce.php b/sizeme-for-woocommerce.php index 2836656..eb73b19 100644 --- a/sizeme-for-woocommerce.php +++ b/sizeme-for-woocommerce.php @@ -9,7 +9,7 @@ * @wordpress-plugin * Plugin Name: SizeMe for WooCommerce * Description: SizeMe is a web store plugin that enables your consumers to input their measurements and get personalised fit recommendations based on actual product data. - * Version: 2.0.2 + * Version: 2.0.3 * Author: SizeMe Ltd * Author URI: https://www.sizeme.com/ * Text Domain: sizeme @@ -50,7 +50,7 @@ class WC_SizeMe_for_WooCommerce { * * @var string VERSION The plugin version. */ - const VERSION = '2.0.2'; + const VERSION = '2.0.3'; /** * Minimum WordPress version this plugin works with, used for dependency checks. diff --git a/templates/sizeme-product.php b/templates/sizeme-product.php index 04344d2..b34c388 100644 --- a/templates/sizeme-product.php +++ b/templates/sizeme-product.php @@ -46,7 +46,7 @@ if ( $sizeme->is_service_test() ) { echo 'sizeme_options.debugState = "true";'.PHP_EOL; } - + // UI OPTIONS $uiOptions = array( 'appendContentTo' => WC_SizeMe_for_WooCommerce::APPEND_CONTENT_TO, @@ -56,7 +56,7 @@ 'addToCartEvent' => WC_SizeMe_for_WooCommerce::ADD_TO_CART_EVENT, 'lang' => WC_SizeMe_for_WooCommerce::LANG_OVERRIDE ); - + foreach ($uiOptions as $key => $value) { if ( $sizeme->get_ui_option( $value, '' ) ) { printf('sizeme_options.uiOptions.%s = "%s";'.PHP_EOL, $key, esc_js($sizeme->get_ui_option( $value, '' ))); @@ -82,6 +82,17 @@ } }; +get_ui_option( WC_SizeMe_for_WooCommerce::INVOKE_ELEMENT, '' ) ) $el = $sizeme->get_ui_option( WC_SizeMe_for_WooCommerce::INVOKE_ELEMENT, '' ); + echo 'if (window.jQuery) { jQuery(function() { document.querySelector("'.$el.'").addEventListener("sizemeChange", function(e) { jQuery("'.$el.'").trigger("change"); }) } ); }'; +?> //]]>