WooCommerce Variation Swatches - Version 2.0.10

Version Description

  • 15-09-2022 =

  • Update: WooCommerce Support

  • Update: JS Scripts

  • Fix: WPML Option issue

Download this release

Release Info

Developer EmranAhmed
Plugin Icon 128x128 WooCommerce Variation Swatches
Version 2.0.10
Comparing to
See all releases

Code changes from version 2.0.9 to 2.0.10

README.txt CHANGED
@@ -5,8 +5,8 @@ Requires PHP: 7.0
5
  Requires at least: 5.5
6
  Tested up to: 6.0
7
  WC requires at least: 5.5
8
- WC tested up to: 6.8
9
- Stable tag: 2.0.9
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
@@ -616,6 +616,12 @@ And your are ready to go.
616
 
617
  == Changelog ==
618
 
 
 
 
 
 
 
619
  = 2.0.9 - 28-08-2022 =
620
 
621
  * Update: Translation String
5
  Requires at least: 5.5
6
  Tested up to: 6.0
7
  WC requires at least: 5.5
8
+ WC tested up to: 6.9
9
+ Stable tag: 2.0.10
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
616
 
617
  == Changelog ==
618
 
619
+ = 2.0.10 - 15-09-2022 =
620
+
621
+ * Update: WooCommerce Support
622
+ * Update: JS Scripts
623
+ * Fix: WPML Option issue
624
+
625
  = 2.0.9 - 28-08-2022 =
626
 
627
  * Update: Translation String
assets/css/admin.css CHANGED
@@ -2,7 +2,7 @@
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
- * Date: 8/28/2022, 4:17:31 PM
6
  * Released under the GPLv3 license.
7
  */
8
  .button.button-danger {
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
+ * Date: 9/15/2022, 6:49:48 PM
6
  * Released under the GPLv3 license.
7
  */
8
  .button.button-danger {
assets/css/frontend.css CHANGED
@@ -2,7 +2,7 @@
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
- * Date: 8/28/2022, 4:17:31 PM
6
  * Released under the GPLv3 license.
7
  */
8
  .woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip] {
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
+ * Date: 9/15/2022, 6:49:48 PM
6
  * Released under the GPLv3 license.
7
  */
8
  .woo-variation-swatches.wvs-tooltip .radio-variable-item[data-wvstooltip] {
assets/js/admin.js CHANGED
@@ -2,7 +2,7 @@
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
- * Date: 8/28/2022, 4:17:31 PM
6
  * Released under the GPLv3 license.
7
  */
8
  /******/ (function() { // webpackBootstrap
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
+ * Date: 9/15/2022, 6:49:48 PM
6
  * Released under the GPLv3 license.
7
  */
8
  /******/ (function() { // webpackBootstrap
assets/js/frontend.js CHANGED
@@ -2,7 +2,7 @@
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
- * Date: 8/28/2022, 4:17:31 PM
6
  * Released under the GPLv3 license.
7
  */
8
  /******/ (function() { // webpackBootstrap
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
+ * Date: 9/15/2022, 6:49:48 PM
6
  * Released under the GPLv3 license.
7
  */
8
  /******/ (function() { // webpackBootstrap
assets/js/wp-color-picker-alpha.js CHANGED
@@ -2,7 +2,7 @@
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
- * Date: 8/28/2022, 4:17:31 PM
6
  * Released under the GPLv3 license.
7
  */
8
  /******/ (function() { // webpackBootstrap
2
  * Variation Swatches for WooCommerce
3
  *
4
  * Author: Emran Ahmed ( emran.bd.08@gmail.com )
5
+ * Date: 9/15/2022, 6:49:48 PM
6
  * Released under the GPLv3 license.
7
  */
8
  /******/ (function() { // webpackBootstrap
includes/class-woo-variation-swatches-product-page.php CHANGED
@@ -24,7 +24,7 @@
24
  }
25
 
26
  protected function includes() {
27
-
28
  }
29
 
30
  protected function hooks() {
@@ -39,7 +39,9 @@
39
  add_filter( 'woocommerce_available_variation', array( $this, 'add_variation_data' ), 10, 3 );
40
  // add_action( 'woocommerce_after_variations_form', array( $this, 'enqueue_script' ) );
41
 
42
- add_filter( 'nocache_headers', array( $this, 'cache_ajax_response' ) );
 
 
43
  }
44
 
45
  protected function init() {
@@ -48,25 +50,41 @@
48
 
49
  // Start
50
 
51
- public function cache_ajax_response( $headers ) {
52
  global $wp_query;
53
  if ( ! is_ajax() ) {
54
- return $headers;
 
 
 
 
 
 
 
 
 
55
  }
56
 
57
- if ( ! is_object( $wp_query ) ) {
 
 
 
 
 
 
58
  return $headers;
59
  }
60
 
61
- $action = $wp_query->get( 'wc-ajax' ) ? sanitize_text_field( $wp_query->get( 'wc-ajax' ) ) : false;
 
62
  $requests = array( 'woo_get_variations', 'woo_get_all_variations' );
63
  if ( $action && in_array( $action, $requests ) ) {
64
  // ask the browser to cache this response
65
 
66
  $expires = HOUR_IN_SECONDS; // 1 hr
67
- $cache_control = sprintf( 'public, max-age=%d', $expires );
68
 
69
- $headers[ 'Pragma' ] = 'public'; // public / cache. backwards compatibility with HTTP/1.0 caches
70
  $headers[ 'Expires' ] = $expires;
71
  $headers[ 'Cache-Control' ] = $cache_control;
72
  $headers[ 'X-Variation-Swatches-Ajax-Header-Modified' ] = true;
@@ -164,7 +182,7 @@
164
 
165
  $this->add_inline_style();
166
 
167
- wp_register_script( 'woo-variation-swatches', woo_variation_swatches()->assets_url( "/js/frontend{$suffix}.js" ), array( 'jquery', 'wp-util', 'underscore', 'jquery-blockui' ), woo_variation_swatches()->assets_version( "/js/frontend{$suffix}.js" ), true );
168
 
169
  wp_localize_script( 'woo-variation-swatches', 'woo_variation_swatches_options', $this->js_options() );
170
 
24
  }
25
 
26
  protected function includes() {
27
+
28
  }
29
 
30
  protected function hooks() {
39
  add_filter( 'woocommerce_available_variation', array( $this, 'add_variation_data' ), 10, 3 );
40
  // add_action( 'woocommerce_after_variations_form', array( $this, 'enqueue_script' ) );
41
 
42
+ // add_filter( 'nocache_headers', array( $this, 'cache_ajax_response' ), 99 );
43
+ // add_action( 'wp', array( $this, 'stop_prevent_ajax_caching' ), 1 );
44
+ // wp_cache_flush()
45
  }
46
 
47
  protected function init() {
50
 
51
  // Start
52
 
53
+ public function stop_prevent_ajax_caching() {
54
  global $wp_query;
55
  if ( ! is_ajax() ) {
56
+ return true;
57
+ }
58
+
59
+ $action = isset( $_GET[ 'wc-ajax' ] ) ? sanitize_text_field( $_GET[ 'wc-ajax' ] ) : false;
60
+ $requests = array( 'woo_get_variations', 'woo_get_all_variations' );
61
+
62
+ if ( $action && in_array( $action, $requests ) ) {
63
+ wc_maybe_define_constant( 'DONOTCACHEPAGE', false );
64
+ wc_maybe_define_constant( 'DONOTCACHEOBJECT', false );
65
+ wc_maybe_define_constant( 'DONOTCACHEDB', false );
66
  }
67
 
68
+ return true;
69
+
70
+ }
71
+
72
+ public function cache_ajax_response( $headers ) {
73
+
74
+ if ( ! is_ajax() ) {
75
  return $headers;
76
  }
77
 
78
+ $action = isset( $_GET[ 'wc-ajax' ] ) ? sanitize_text_field( $_GET[ 'wc-ajax' ] ) : false;
79
+
80
  $requests = array( 'woo_get_variations', 'woo_get_all_variations' );
81
  if ( $action && in_array( $action, $requests ) ) {
82
  // ask the browser to cache this response
83
 
84
  $expires = HOUR_IN_SECONDS; // 1 hr
85
+ $cache_control = sprintf( 'public, s-max-age=%d', $expires );
86
 
87
+ $headers[ 'Pragma' ] = 'cache'; // public / cache. backwards compatibility with HTTP/1.0 caches
88
  $headers[ 'Expires' ] = $expires;
89
  $headers[ 'Cache-Control' ] = $cache_control;
90
  $headers[ 'X-Variation-Swatches-Ajax-Header-Modified' ] = true;
182
 
183
  $this->add_inline_style();
184
 
185
+ wp_register_script( 'woo-variation-swatches', woo_variation_swatches()->assets_url( "/js/frontend{$suffix}.js" ), array( 'jquery', 'wp-util', 'underscore', 'jquery-blockui', 'wp-api-request', 'wp-api-fetch', 'wp-polyfill' ), woo_variation_swatches()->assets_version( "/js/frontend{$suffix}.js" ), true );
186
 
187
  wp_localize_script( 'woo-variation-swatches', 'woo_variation_swatches_options', $this->js_options() );
188
 
languages/woo-variation-swatches.pot CHANGED
@@ -7,7 +7,7 @@ msgstr ""
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
  "Language-Team: Emran Ahmed <emran.bd.08@gmail.com>\n"
10
- "POT-Creation-Date: 2022-08-28 10:17+0000\n"
11
  "X-Poedit-Basepath: ..\n"
12
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
13
  "X-Poedit-SearchPath-0: .\n"
@@ -197,11 +197,11 @@ msgstr ""
197
  msgid "Unable to use image \"%s\"."
198
  msgstr ""
199
 
200
- #: ../includes/class-woo-variation-swatches-product-page.php:89
201
  msgid "%s left"
202
  msgstr ""
203
 
204
- #: ../includes/class-woo-variation-swatches-product-page.php:666, ../includes/class-woo-variation-swatches-product-page.php:692
205
  msgid "Choose an option"
206
  msgstr ""
207
 
7
  "Content-Type: text/plain; charset=UTF-8\n"
8
  "Content-Transfer-Encoding: 8bit\n"
9
  "Language-Team: Emran Ahmed <emran.bd.08@gmail.com>\n"
10
+ "POT-Creation-Date: 2022-09-15 12:49+0000\n"
11
  "X-Poedit-Basepath: ..\n"
12
  "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n"
13
  "X-Poedit-SearchPath-0: .\n"
197
  msgid "Unable to use image \"%s\"."
198
  msgstr ""
199
 
200
+ #: ../includes/class-woo-variation-swatches-product-page.php:107
201
  msgid "%s left"
202
  msgstr ""
203
 
204
+ #: ../includes/class-woo-variation-swatches-product-page.php:684, ../includes/class-woo-variation-swatches-product-page.php:710
205
  msgid "Choose an option"
206
  msgstr ""
207
 
woo-variation-swatches.php CHANGED
@@ -4,13 +4,13 @@
4
  * Plugin URI: https://wordpress.org/plugins/woo-variation-swatches/
5
  * Description: Beautiful colors, images and buttons variation swatches for woocommerce product attributes. Requires WooCommerce 5.6+
6
  * Author: Emran Ahmed
7
- * Version: 2.0.9
8
  * Domain Path: /languages
9
  * Requires PHP: 7.0
10
  * Requires at least: 5.6
11
  * WC requires at least: 5.6
12
  * Tested up to: 6.0
13
- * WC tested up to: 6.8
14
  * Text Domain: woo-variation-swatches
15
  * Author URI: https://getwooplugins.com/
16
  */
@@ -18,7 +18,7 @@
18
  defined( 'ABSPATH' ) or die( 'Keep Silent' );
19
 
20
  if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION' ) ) {
21
- define( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION', '2.0.9' );
22
  }
23
 
24
  if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_FILE' ) ) {
4
  * Plugin URI: https://wordpress.org/plugins/woo-variation-swatches/
5
  * Description: Beautiful colors, images and buttons variation swatches for woocommerce product attributes. Requires WooCommerce 5.6+
6
  * Author: Emran Ahmed
7
+ * Version: 2.0.10
8
  * Domain Path: /languages
9
  * Requires PHP: 7.0
10
  * Requires at least: 5.6
11
  * WC requires at least: 5.6
12
  * Tested up to: 6.0
13
+ * WC tested up to: 6.9
14
  * Text Domain: woo-variation-swatches
15
  * Author URI: https://getwooplugins.com/
16
  */
18
  defined( 'ABSPATH' ) or die( 'Keep Silent' );
19
 
20
  if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION' ) ) {
21
+ define( 'WOO_VARIATION_SWATCHES_PLUGIN_VERSION', '2.0.10' );
22
  }
23
 
24
  if ( ! defined( 'WOO_VARIATION_SWATCHES_PLUGIN_FILE' ) ) {