Variation Swatches for WooCommerce - Version 2.1.3

Version Description

  • Fixed firefox showing unavailable sizes
  • Create option for image position for swatches
  • Added arrows for the margin and padding setting fields
  • Fix swatches not resetting appearance on click event
  • Add option to use variable image only
  • Add an option to disable checking variation availability
Download this release

Release Info

Developer themealien
Plugin Icon 128x128 Variation Swatches for WooCommerce
Version 2.1.3
Comparing to
See all releases

Code changes from version 2.1.2 to 2.1.3

assets/css/admin.css CHANGED
@@ -354,6 +354,19 @@ span.sw-input-type-text {
354
  border-bottom-right-radius: 5px;
355
  }
356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  input.font-size-input {
358
  width: 70px;
359
  margin-right: 10px;
@@ -534,9 +547,19 @@ button.accor-tab-btn.active-at-btn {
534
  .variation-switch-field {
535
  display: flex;
536
  }
537
- .variation-switch-field .field-with-html-after {
 
538
  position: relative;
539
  }
 
 
 
 
 
 
 
 
 
540
  .variation-switch-field .wp-picker-container .wp-color-result.button {
541
  margin-left: 0;
542
  }
354
  border-bottom-right-radius: 5px;
355
  }
356
 
357
+ span.sw-input-type-icon {
358
+ display: block;
359
+ background: #F0F0F1;
360
+ height: 28px;
361
+ padding: 0 7px;
362
+ position: absolute;
363
+ line-height: 28px;
364
+ left: 2px;
365
+ top: 1px;
366
+ border-top-left-radius: 5px;
367
+ border-bottom-left-radius: 5px;
368
+ }
369
+
370
  input.font-size-input {
371
  width: 70px;
372
  margin-right: 10px;
547
  .variation-switch-field {
548
  display: flex;
549
  }
550
+ .variation-switch-field .field-with-html-after,
551
+ .variation-switch-field .field-with-html-before {
552
  position: relative;
553
  }
554
+ .variation-switch-field .field-with-html-before input[type=number] {
555
+ padding-left: 27px;
556
+ width: 65px;
557
+ -moz-appearance: textfield;
558
+ }
559
+ .variation-switch-field .field-with-html-before input[type=number]::-webkit-outer-spin-button, .variation-switch-field .field-with-html-before input[type=number]::-webkit-inner-spin-button {
560
+ -webkit-appearance: none;
561
+ margin: 0;
562
+ }
563
  .variation-switch-field .wp-picker-container .wp-color-result.button {
564
  margin-left: 0;
565
  }
assets/css/admin.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":"","sources":["admin.scss"],"names":[],"mappings":";AACE;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;AAEA;EACE;;AAIA;EACE;;AAGF;EACE;;;AAKN;AAEA;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;AAEA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EASE;;AARA;EACE;EACA;EACA;EACA;EACA;;;AAQR;EACE;IACE;IACA;;;EAGF;IACE;IACA;IACA;;;EAGF;IACE;IACA;IACA;;;EAGF;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;AAAA;AAIA;EACE;EACA;EACA;;;AAIA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;;AAKF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAIA;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;;AAKN;EACE;IACE;IACA;IACA;IACA;;;AAIJ;EAEI;IACE;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;;EAEA;IACE;;;AAMR;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAIA;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAIA;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAEA;AAAA;EAEE;;AAGF;AAAA;EAEE;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAKN;EACE;EACA;;AAEA;EACE;;AAGF;EACE;;;AAKN;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;;AAEA;EACE;;;AAKN;AAEA;AAEA;AAEA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;;AAEA;EACE;;;AAIJ;EACE;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EACE;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIJ;EACE;;;AAIJ;EACE;;AAEA;EACE;EACA;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAOE;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAKF;EACE;;AAKF;EACE;;;AAMR;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAIA;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAMN;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;IACE;;;AAKF;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAIA;EACE;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIJ;EACE;IACE;;;AAIJ;EACE;IACE;IACA;;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAEA;IACE;IACA;;;EAIJ;IACE;;;EAGF;IACE;;;EAGF;IACE;;;AAIJ;EACE;;;AAIA;EACE;EACA;;AAGF;EACE;;;AAIJ;EACE;IACE;IACA;;;AAIJ;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAGE;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAEA;EACE;;AAIJ;EACE;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAEA;EACE;;AAKF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;EACA;EACA;;AAIA;EACE;EACA;EACA;;;AAKN;EAEI;IACE;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;;;AAMJ;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGE;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAIA;EACE;;;AAQV;EACE;EACA;;AAGE;EACE;;AAEA;EACE;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAMF;EACE;;AAMN;EAzCF;IA0CI;;;AAGF;EA7CF;IA8CI;IACA;;;AAGF;EAlDF;IAmDI;IACA;;;;AAQE;EACE;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAIA;EACE;EACA;;AAGF;EACE;;AAON;EAnDF;IAoDI;IACA;IACA;;;AAEF;EAxDF;IAyDI;IACA;;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAKE;EACE;EACA;EACA;;;AAKN;EACE;;;AAGF;AAAA;AAAA;EAGE;;;AAGF;AAAA;EAEE;;AAGE;AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAKN;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE;;;AAIJ;EAEE;IACE;IACA;IACA;;;AAIJ;EACE;IACE;;;EAGF;IACE;IACA;;;EAIA;IACE;IACA;;EAGF;IACE;;;AAKN;AAEA;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE","file":"admin.css"}
1
+ {"version":3,"sourceRoot":"","sources":["admin.scss"],"names":[],"mappings":";AACE;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;AAEA;EACE;;AAIA;EACE;;AAGF;EACE;;;AAKN;AAEA;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;EACA;;;AAIJ;EACE;EACA;EACA;AAEA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EASE;;AARA;EACE;EACA;EACA;EACA;EACA;;;AAQR;EACE;IACE;IACA;;;EAGF;IACE;IACA;IACA;;;EAGF;IACE;IACA;IACA;;;EAGF;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;IACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAAA;AAAA;AAIA;EACE;EACA;EACA;;;AAIA;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;;AAKF;EACE;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAIA;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;;AAKN;EACE;IACE;IACA;IACA;IACA;;;AAIJ;EAEI;IACE;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;;EAEA;IACE;;;AAMR;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;;;AAIA;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;;AAIA;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAEA;AAAA;EAEE;;AAGF;AAAA;EAEE;;AAGF;EACE;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAKN;EACE;EACA;;AAEA;EACE;;AAGF;EACE;;;AAKN;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;;AAEA;EACE;;;AAKN;AAEA;AAEA;AAEA;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;;AAEA;EACE;;;AAIJ;EACE;;AAEA;AAAA;EAEE;;AAIA;EACE;EACA;EACA;;AAEA;EAEE;EACA;;AAKN;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;;AAEA;EACE;;;AAIJ;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EACE;;AAKN;EACE;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAIJ;EACE;;;AAIJ;EACE;;AAEA;EACE;EACA;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAOE;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAKF;EACE;;AAKF;EACE;;;AAMR;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAIA;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;AAGF;EACE;EACA;;;AAMN;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;IACE;;;AAKF;EACE;;AAGF;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAIA;EACE;;AAEA;EACE;EACA;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;;AAIJ;EACE;IACE;;;AAIJ;EACE;IACE;IACA;;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAEA;IACE;IACA;;;EAIJ;IACE;;;EAGF;IACE;;;EAGF;IACE;;;AAIJ;EACE;;;AAIA;EACE;EACA;;AAGF;EACE;;;AAIJ;EACE;IACE;IACA;;;AAIJ;EACE;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;AAGE;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAEA;EACE;;AAIJ;EACE;EACA;;AAGF;EACE;;AAGF;EACE;EACA;;AAGF;EACE;EACA;EACA;;AAGF;EACE;;AAEA;EACE;;AAKF;EACE;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAIJ;EACE;EACA;EACA;;AAIA;EACE;EACA;EACA;;;AAKN;EAEI;IACE;IACA;IACA;IACA;;EAGF;IACE;IACA;IACA;IACA;;;AAMJ;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAIJ;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;AAEA;EACE;EACA;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAGE;EACE;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAIA;EACE;;;AAQV;EACE;EACA;;AAGE;EACE;;AAEA;EACE;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;EACA;;AAMF;EACE;;AAMN;EAzCF;IA0CI;;;AAGF;EA7CF;IA8CI;IACA;;;AAGF;EAlDF;IAmDI;IACA;;;;AAQE;EACE;;AAIJ;EACE;;AAGF;EACE;EACA;EACA;;AAGF;EACE;EACA;;AAGF;EACE;;AAGF;EACE;;AAGF;EACE;EACA;EACA;;AAIA;EACE;EACA;;AAGF;EACE;;AAON;EAnDF;IAoDI;IACA;IACA;;;AAEF;EAxDF;IAyDI;IACA;;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAKE;EACE;EACA;EACA;;;AAKN;EACE;;;AAGF;AAAA;AAAA;EAGE;;;AAGF;AAAA;EAEE;;AAGE;AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;AAAA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAKN;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE;;;AAIJ;EAEE;IACE;IACA;IACA;;;AAIJ;EACE;IACE;;;EAGF;IACE;IACA;;;EAIA;IACE;IACA;;EAGF;IACE;;;AAKN;AAEA;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE","file":"admin.css"}
assets/css/admin.scss CHANGED
@@ -397,6 +397,19 @@ span.sw-input-type-text {
397
  border-bottom-right-radius: 5px;
398
  }
399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
400
  input.font-size-input {
401
  width: 70px;
402
  margin-right: 10px;
@@ -607,10 +620,25 @@ button.accor-tab-btn {
607
  .variation-switch-field {
608
  display: flex;
609
 
610
- .field-with-html-after {
 
611
  position: relative;
612
  }
613
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  .wp-picker-container .wp-color-result.button {
615
  margin-left: 0;
616
  }
397
  border-bottom-right-radius: 5px;
398
  }
399
 
400
+ span.sw-input-type-icon {
401
+ display: block;
402
+ background: #F0F0F1;
403
+ height: 28px;
404
+ padding: 0 7px;
405
+ position: absolute;
406
+ line-height: 28px;
407
+ left: 2px;
408
+ top: 1px;
409
+ border-top-left-radius: 5px;
410
+ border-bottom-left-radius: 5px;
411
+ }
412
+
413
  input.font-size-input {
414
  width: 70px;
415
  margin-right: 10px;
620
  .variation-switch-field {
621
  display: flex;
622
 
623
+ .field-with-html-after,
624
+ .field-with-html-before {
625
  position: relative;
626
  }
627
 
628
+ .field-with-html-before {
629
+ input[type="number"] {
630
+ padding-left: 27px;
631
+ width: 65px;
632
+ -moz-appearance: textfield;
633
+
634
+ &::-webkit-outer-spin-button,
635
+ &::-webkit-inner-spin-button {
636
+ -webkit-appearance: none;
637
+ margin: 0;
638
+ }
639
+ }
640
+ }
641
+
642
  .wp-picker-container .wp-color-result.button {
643
  margin-left: 0;
644
  }
assets/js/frontend.js CHANGED
@@ -8,10 +8,14 @@
8
  return this.each(function () {
9
  var $form = $(this);
10
 
 
 
 
 
 
 
11
  $form
12
  .addClass('swatches-support')
13
- .data("product_variations", $form.find(".tawcvs-available-product-variation").data("product_variations"))
14
- .trigger('reload_product_variations')
15
  .on("found_variation", function (event, variation) {
16
  change_variation_image_on_shop_page($form, variation);
17
  })
@@ -77,15 +81,17 @@
77
  var $swatch = $(this),
78
  value = $swatch.attr('data-value');
79
 
 
 
80
  if (values.indexOf(value) > -1) {
81
  $swatch.removeClass('disabled');
82
  } else {
83
  $swatch.addClass('disabled');
84
-
85
  if ($swatch.closest('.tawcvs-swatches').hasClass('oss-hide')) {
86
  $swatch.closest('.swatch-item-wrapper').hide();
87
  }
88
-
89
  if ($selected.length && value === $selected.val()) {
90
  $swatch.removeClass('selected');
91
  }
@@ -103,36 +109,24 @@
103
  //Tracking the reset_variations button on change visibility -> change the corresponding display state
104
  function toggle_hidden_variation_btn() {
105
  const resetVariationNodes = document.getElementsByClassName('reset_variations');
106
-
107
  if (resetVariationNodes.length) {
108
-
109
  Array.prototype.forEach.call(resetVariationNodes, function (resetVariationEle) {
110
-
111
  let observer = new MutationObserver(function () {
112
-
113
  if (resetVariationEle.style.visibility !== 'hidden') {
114
-
115
  resetVariationEle.style.display = 'block';
116
-
117
  } else {
118
-
119
  resetVariationEle.style.display = 'none';
120
-
121
  }
122
-
123
  });
124
-
125
  observer.observe(resetVariationEle, {attributes: true, childList: true});
126
-
127
  })
128
-
129
  }
130
  }
131
 
132
  function change_variation_image_on_shop_page($form, variation) {
133
  var $product = $form.closest('.product'),
134
  $product_img = $product.find('.woocommerce-LoopProduct-link img');
135
-
136
  if ($product_img.length !== 1) {
137
  return false;
138
  }
@@ -167,17 +161,17 @@
167
  }
168
 
169
  $(function () {
170
- $('.variations_form').tawcvs_variation_swatches_form();
171
  $(document.body).trigger('tawcvs_initialized');
172
  toggle_hidden_variation_btn();
173
  });
174
 
175
- $(document).ajaxComplete(function () {
176
  var $variations_form = $('.variations_form:not(.swatches-support)');
177
  if ($variations_form.length > 0) {
178
- $variations_form.each(function() {
179
- $(this).wc_variation_form();
180
- });
181
  $variations_form.tawcvs_variation_swatches_form();
182
  }
183
  });
8
  return this.each(function () {
9
  var $form = $(this);
10
 
11
+ if (typeof $form.find(".tawcvs-available-product-variation").data("product_variations") !== "undefined") {
12
+ $form.data("product_variations", $form.find(".tawcvs-available-product-variation").data("product_variations"))
13
+ .trigger('reload_product_variations')
14
+ .trigger('update_variation_values');
15
+ }
16
+
17
  $form
18
  .addClass('swatches-support')
 
 
19
  .on("found_variation", function (event, variation) {
20
  change_variation_image_on_shop_page($form, variation);
21
  })
81
  var $swatch = $(this),
82
  value = $swatch.attr('data-value');
83
 
84
+ $swatch.closest('.swatch-item-wrapper').show();
85
+
86
  if (values.indexOf(value) > -1) {
87
  $swatch.removeClass('disabled');
88
  } else {
89
  $swatch.addClass('disabled');
90
+
91
  if ($swatch.closest('.tawcvs-swatches').hasClass('oss-hide')) {
92
  $swatch.closest('.swatch-item-wrapper').hide();
93
  }
94
+
95
  if ($selected.length && value === $selected.val()) {
96
  $swatch.removeClass('selected');
97
  }
109
  //Tracking the reset_variations button on change visibility -> change the corresponding display state
110
  function toggle_hidden_variation_btn() {
111
  const resetVariationNodes = document.getElementsByClassName('reset_variations');
 
112
  if (resetVariationNodes.length) {
 
113
  Array.prototype.forEach.call(resetVariationNodes, function (resetVariationEle) {
 
114
  let observer = new MutationObserver(function () {
 
115
  if (resetVariationEle.style.visibility !== 'hidden') {
 
116
  resetVariationEle.style.display = 'block';
 
117
  } else {
 
118
  resetVariationEle.style.display = 'none';
 
119
  }
 
120
  });
 
121
  observer.observe(resetVariationEle, {attributes: true, childList: true});
 
122
  })
 
123
  }
124
  }
125
 
126
  function change_variation_image_on_shop_page($form, variation) {
127
  var $product = $form.closest('.product'),
128
  $product_img = $product.find('.woocommerce-LoopProduct-link img');
129
+
130
  if ($product_img.length !== 1) {
131
  return false;
132
  }
161
  }
162
 
163
  $(function () {
164
+ $('.variations_form').tawcvs_variation_swatches_form().trigger('woocommerce_update_variation_values');
165
  $(document.body).trigger('tawcvs_initialized');
166
  toggle_hidden_variation_btn();
167
  });
168
 
169
+ $(document).ajaxComplete(function () {
170
  var $variations_form = $('.variations_form:not(.swatches-support)');
171
  if ($variations_form.length > 0) {
172
+ $variations_form.each(function () {
173
+ $(this).wc_variation_form();
174
+ });
175
  $variations_form.tawcvs_variation_swatches_form();
176
  }
177
  });
includes/class-frontend.php CHANGED
@@ -43,9 +43,9 @@ class TA_WC_Variation_Swatches_Frontend {
43
 
44
  $this->generalSettings = isset( $latest_option['general'] ) ? $latest_option['general'] : array();
45
  $this->archiveSettings = isset( $latest_option['archive'] ) ? $latest_option['archive'] : array();
46
- $this->productDesign = isset( $latest_option['design']['productDesign'] ) ? $latest_option['design']['productDesign'] : array();
47
- $this->shopDesign = isset( $latest_option['design']['shopDesign'] ) ? $latest_option['design']['shopDesign'] : array();
48
- $this->toolTipDesign = isset( $latest_option['design']['toolTipDesign'] ) ? $latest_option['design']['toolTipDesign'] : array();
49
 
50
 
51
  if ( isset( $this->archiveSettings['show-clear-link'] ) && ! $this->archiveSettings['show-clear-link'] ) {
@@ -72,7 +72,7 @@ class TA_WC_Variation_Swatches_Frontend {
72
  if ( empty( $attr ) ) {
73
  return '';
74
  }
75
- $supported_swatch_types = TA_WCVS()->types;
76
  $dropdown_to_label_setting = isset( $this->generalSettings['dropdown-to-label'] ) && $this->generalSettings['dropdown-to-label'];
77
 
78
  // If the type isn't supported, and we turned on the setting to convert dropdown to label/image
@@ -102,8 +102,13 @@ class TA_WC_Variation_Swatches_Frontend {
102
  */
103
  public function get_available_variation() {
104
  global $product;
 
 
 
 
 
105
  if ( $product instanceof WC_Product_Variable ) {
106
- $variations_json = wp_json_encode( $product->get_available_variations() );
107
  $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
108
  if ( ! empty( $variations_attr ) ) {
109
  ?>
@@ -144,13 +149,13 @@ class TA_WC_Variation_Swatches_Frontend {
144
  return $html;
145
  }
146
 
147
- $options = $args['options'];
148
- $product = $args['product'];
149
  $attribute_tax_name = $args['attribute'];
150
- $class = "variation-selector variation-select-{$attr->attribute_type}";
151
- $swatches = '';
152
- $is_product_page = is_product();
153
- $defined_limit = apply_filters( 'tawcvs_swatch_limit_number', 0 );
154
  $out_of_stock_state = apply_filters( 'tawcvs_out_of_stock_state', '' );
155
 
156
  //If this product has disabled the variation swatches
@@ -160,7 +165,7 @@ class TA_WC_Variation_Swatches_Frontend {
160
 
161
  if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute_tax_name ) ) {
162
  $attributes = $product->get_variation_attributes();
163
- $options = $attributes[ $attribute_tax_name ];
164
  }
165
 
166
 
@@ -170,9 +175,14 @@ class TA_WC_Variation_Swatches_Frontend {
170
 
171
  // Add new option for tooltip to $args variable.
172
  $args['tooltip'] = apply_filters( 'tawcvs_tooltip_enabled', $this->is_tooltip_enabled() );
 
173
  //Get the product variation detail for each attribute
174
  //If there are more than one attributes, the first one will be applied
175
- $collected_variations = TA_WC_Variation_Swatches::get_detailed_product_variations( $product, $attribute_tax_name );
 
 
 
 
176
 
177
  if ( ! empty( $options ) && taxonomy_exists( $attribute_tax_name ) ) {
178
  // Get terms if this is a taxonomy - ordered. We need the names too.
@@ -200,14 +210,22 @@ class TA_WC_Variation_Swatches_Frontend {
200
  }
201
 
202
  if ( ! empty( $swatches ) ) {
203
- $class .= ' hidden';
204
  $swatches = '<div class="tawcvs-swatches oss-' . $out_of_stock_state . '" data-attribute_name="attribute_' . esc_attr( $attribute_tax_name ) . '">' . $swatches . '</div>';
205
- $html = '<div class="' . esc_attr( $class ) . '">' . $html . '</div>' . $swatches;
206
  }
207
 
208
  return $html;
209
  }
210
 
 
 
 
 
 
 
 
 
211
  private function is_disabled_variation_swatches( $product ) {
212
  if ( ! $product instanceof WC_Product_Variable ) {
213
  return false;
@@ -251,35 +269,45 @@ class TA_WC_Variation_Swatches_Frontend {
251
  public function swatch_html( $html, $term, $type, $args ) {
252
 
253
  $selected = sanitize_title( $args['selected'] ) == $term->slug ? 'selected' : '';
254
- $name = esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) );
255
 
256
  $tooltip = $this->get_tooltip_html( '', $term, $name, $args );
257
  $tooltip = apply_filters( 'tawcvs_tooltip_html', $tooltip, $term, $name, $args );
258
 
259
  $swatchShape = isset( $this->generalSettings['swatch-shape'] ) ? $this->generalSettings['swatch-shape'] : 'circle';
260
 
261
-
262
  switch ( $type ) {
263
  case 'color':
264
- $main_color = get_term_meta( $term->term_id, 'color', true );
265
  $formatted_color_style = TA_WC_Variation_Swatches::generate_color_style( $term->term_id, $main_color );
266
  list( $r, $g, $b ) = sscanf( $main_color, "#%02x%02x%02x" );
 
 
 
 
 
 
 
 
 
 
 
267
  $html = sprintf(
268
- '<div class="swatch-item-wrapper"><div class="swatch swatch-shape-' . $swatchShape . ' swatch-color swatch-%s %s" style="background:%s;color:%s;" data-value="%s"></div>%s</div>',
269
  esc_attr( $term->slug ),
270
  $selected,
271
  esc_attr( $formatted_color_style ),
272
- "rgba($r,$g,$b,0.5)",
273
  esc_attr( $term->slug ),
 
274
  $tooltip
275
  );
276
  break;
277
-
278
  case 'image':
279
  // First, we check the default thumbnail of attribute variation
280
  $attach_id = get_term_meta( $term->term_id, 'image', true );
281
  if ( ! empty( $attach_id ) ) {
282
- $image_url = wp_get_attachment_image_url( $attach_id );
283
  } else {
284
  //If we also do not have default thumbnail, we will use the placeholder image of WC
285
  $image_url = WC()->plugin_url() . '/assets/images/placeholder.png';
@@ -287,20 +315,20 @@ class TA_WC_Variation_Swatches_Frontend {
287
  $image_url = apply_filters( 'tawcvs_product_swatch_image_url', $image_url, $args );
288
 
289
  $html = sprintf(
290
- '<div class="swatch-item-wrapper"><div class="swatch swatch-shape-' . $swatchShape . ' swatch-image swatch-%s %s %s" data-value="%s"><img src="%s" alt="%s"></div>%s</div>',
291
  esc_attr( $term->slug ),
292
  $selected,
293
  apply_filters( 'tawcvs_swatch_image_ratio_class', 'swatch-ratio-disabled' ),
294
  esc_attr( $term->slug ),
295
  esc_url( $image_url ),
296
- esc_attr( $name ),
297
  $tooltip
298
  );
299
  break;
300
  case 'label':
301
  $label = get_term_meta( $term->term_id, 'label', true );
302
  $label = $label ?: $name;
303
- $html = sprintf(
304
  '<div class="swatch-item-wrapper"><div class="swatch swatch-shape-' . $swatchShape . ' swatch-label swatch-%s %s" data-value="%s"><span class="text">%s</span></div>%s</div>',
305
  esc_attr( $term->slug ),
306
  $selected,
@@ -345,6 +373,9 @@ class TA_WC_Variation_Swatches_Frontend {
345
  echo '<div class="swatch-align-' . $alignment . '">';
346
  do_action( 'woocommerce_variable_add_to_cart' );
347
  echo '</div>';
 
 
 
348
  } else {
349
  return $html;
350
  }
@@ -363,6 +394,19 @@ class TA_WC_Variation_Swatches_Frontend {
363
 
364
  return wc_string_to_bool( isset( $this->generalSettings['enable-tooltip'] ) ? $this->generalSettings['enable-tooltip'] : 0 );
365
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
366
 
367
  /**
368
  * Render the tooltip html if it is enabled
43
 
44
  $this->generalSettings = isset( $latest_option['general'] ) ? $latest_option['general'] : array();
45
  $this->archiveSettings = isset( $latest_option['archive'] ) ? $latest_option['archive'] : array();
46
+ $this->productDesign = isset( $latest_option['design']['productDesign'] ) ? $latest_option['design']['productDesign'] : array();
47
+ $this->shopDesign = isset( $latest_option['design']['shopDesign'] ) ? $latest_option['design']['shopDesign'] : array();
48
+ $this->toolTipDesign = isset( $latest_option['design']['toolTipDesign'] ) ? $latest_option['design']['toolTipDesign'] : array();
49
 
50
 
51
  if ( isset( $this->archiveSettings['show-clear-link'] ) && ! $this->archiveSettings['show-clear-link'] ) {
72
  if ( empty( $attr ) ) {
73
  return '';
74
  }
75
+ $supported_swatch_types = TA_WCVS()->types;
76
  $dropdown_to_label_setting = isset( $this->generalSettings['dropdown-to-label'] ) && $this->generalSettings['dropdown-to-label'];
77
 
78
  // If the type isn't supported, and we turned on the setting to convert dropdown to label/image
102
  */
103
  public function get_available_variation() {
104
  global $product;
105
+
106
+ if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) || $this->is_disabled_checking_availability()) {
107
+ return '';
108
+ }
109
+
110
  if ( $product instanceof WC_Product_Variable ) {
111
+ $variations_json = wp_json_encode( TA_WC_Variation_Swatches::get_available_variations( $product, true, true ) );
112
  $variations_attr = function_exists( 'wc_esc_json' ) ? wc_esc_json( $variations_json ) : _wp_specialchars( $variations_json, ENT_QUOTES, 'UTF-8', true );
113
  if ( ! empty( $variations_attr ) ) {
114
  ?>
149
  return $html;
150
  }
151
 
152
+ $options = $args['options'];
153
+ $product = $args['product'];
154
  $attribute_tax_name = $args['attribute'];
155
+ $class = "variation-selector variation-select-{$attr->attribute_type}";
156
+ $swatches = '';
157
+ $is_product_page = is_product();
158
+ $defined_limit = apply_filters( 'tawcvs_swatch_limit_number', 0 );
159
  $out_of_stock_state = apply_filters( 'tawcvs_out_of_stock_state', '' );
160
 
161
  //If this product has disabled the variation swatches
165
 
166
  if ( empty( $options ) && ! empty( $product ) && ! empty( $attribute_tax_name ) ) {
167
  $attributes = $product->get_variation_attributes();
168
+ $options = $attributes[ $attribute_tax_name ];
169
  }
170
 
171
 
175
 
176
  // Add new option for tooltip to $args variable.
177
  $args['tooltip'] = apply_filters( 'tawcvs_tooltip_enabled', $this->is_tooltip_enabled() );
178
+
179
  //Get the product variation detail for each attribute
180
  //If there are more than one attributes, the first one will be applied
181
+ $collected_variations = array();
182
+
183
+ if ( TA_WC_Variation_Swatches::is_pro_addon_active() && ! $this->is_use_attribute_image_only() ) {
184
+ $collected_variations = TA_WC_Variation_Swatches::get_detailed_product_variations( $product, $attribute_tax_name );
185
+ }
186
 
187
  if ( ! empty( $options ) && taxonomy_exists( $attribute_tax_name ) ) {
188
  // Get terms if this is a taxonomy - ordered. We need the names too.
210
  }
211
 
212
  if ( ! empty( $swatches ) ) {
213
+ $class .= ' hidden';
214
  $swatches = '<div class="tawcvs-swatches oss-' . $out_of_stock_state . '" data-attribute_name="attribute_' . esc_attr( $attribute_tax_name ) . '">' . $swatches . '</div>';
215
+ $html = '<div class="' . esc_attr( $class ) . '">' . $html . '</div>' . $swatches;
216
  }
217
 
218
  return $html;
219
  }
220
 
221
+ private function is_use_attribute_image_only() {
222
+ return wc_string_to_bool( isset( $this->generalSettings['attribute-image-only'] ) ? $this->generalSettings['attribute-image-only'] : 0 );
223
+ }
224
+
225
+ private function is_disabled_checking_availability() {
226
+ return wc_string_to_bool( isset( $this->generalSettings['disable-checking-availability'] ) ? $this->generalSettings['disable-checking-availability'] : 0 );
227
+ }
228
+
229
  private function is_disabled_variation_swatches( $product ) {
230
  if ( ! $product instanceof WC_Product_Variable ) {
231
  return false;
269
  public function swatch_html( $html, $term, $type, $args ) {
270
 
271
  $selected = sanitize_title( $args['selected'] ) == $term->slug ? 'selected' : '';
272
+ $name = esc_html( apply_filters( 'woocommerce_variation_option_name', $term->name ) );
273
 
274
  $tooltip = $this->get_tooltip_html( '', $term, $name, $args );
275
  $tooltip = apply_filters( 'tawcvs_tooltip_html', $tooltip, $term, $name, $args );
276
 
277
  $swatchShape = isset( $this->generalSettings['swatch-shape'] ) ? $this->generalSettings['swatch-shape'] : 'circle';
278
 
 
279
  switch ( $type ) {
280
  case 'color':
281
+ $main_color = get_term_meta( $term->term_id, 'color', true );
282
  $formatted_color_style = TA_WC_Variation_Swatches::generate_color_style( $term->term_id, $main_color );
283
  list( $r, $g, $b ) = sscanf( $main_color, "#%02x%02x%02x" );
284
+
285
+ if ( $this->is_show_label_enabled() ) {
286
+ $class = ' swatch-label ';
287
+ $text_shadow = 'text-shadow: -1px -1px 0 #555, 1px -1px 0 #555, -1px 1px 0 #555, 1px 1px 0 #555;';
288
+ $color = 'white';
289
+ } else {
290
+ $class = ' swatch-color ';
291
+ $text_shadow = '';
292
+ $color = 'rgba($r,$g,$b,0.5)';
293
+ }
294
+
295
  $html = sprintf(
296
+ '<div class="swatch-item-wrapper"><div class="swatch swatch-shape-' . $swatchShape . $class . ' swatch-%s %s" style="background:%s;color:%s;' . $text_shadow . '" data-value="%s"><span class="text">%s</span></div>%s</div>',
297
  esc_attr( $term->slug ),
298
  $selected,
299
  esc_attr( $formatted_color_style ),
300
+ $color,
301
  esc_attr( $term->slug ),
302
+ $name,
303
  $tooltip
304
  );
305
  break;
 
306
  case 'image':
307
  // First, we check the default thumbnail of attribute variation
308
  $attach_id = get_term_meta( $term->term_id, 'image', true );
309
  if ( ! empty( $attach_id ) ) {
310
+ $image_url = wp_get_attachment_image_url( $attach_id, 'large' );
311
  } else {
312
  //If we also do not have default thumbnail, we will use the placeholder image of WC
313
  $image_url = WC()->plugin_url() . '/assets/images/placeholder.png';
315
  $image_url = apply_filters( 'tawcvs_product_swatch_image_url', $image_url, $args );
316
 
317
  $html = sprintf(
318
+ '<div class="swatch-item-wrapper"><div class="swatch swatch-shape-' . $swatchShape . ' swatch-image swatch-%s %s %s" data-value="%s" style="background-image:url(%s);background-size:cover;%s"></div>%s</div>',
319
  esc_attr( $term->slug ),
320
  $selected,
321
  apply_filters( 'tawcvs_swatch_image_ratio_class', 'swatch-ratio-disabled' ),
322
  esc_attr( $term->slug ),
323
  esc_url( $image_url ),
324
+ ( isset( $this->generalSettings['image-position'] ) ? 'background-position:' . $this->generalSettings['image-position'] . ';' : '' ), // background position
325
  $tooltip
326
  );
327
  break;
328
  case 'label':
329
  $label = get_term_meta( $term->term_id, 'label', true );
330
  $label = $label ?: $name;
331
+ $html = sprintf(
332
  '<div class="swatch-item-wrapper"><div class="swatch swatch-shape-' . $swatchShape . ' swatch-label swatch-%s %s" data-value="%s"><span class="text">%s</span></div>%s</div>',
333
  esc_attr( $term->slug ),
334
  $selected,
373
  echo '<div class="swatch-align-' . $alignment . '">';
374
  do_action( 'woocommerce_variable_add_to_cart' );
375
  echo '</div>';
376
+
377
+ // fix variation doesn't appear on list page
378
+ add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
379
  } else {
380
  return $html;
381
  }
394
 
395
  return wc_string_to_bool( isset( $this->generalSettings['enable-tooltip'] ) ? $this->generalSettings['enable-tooltip'] : 0 );
396
  }
397
+ /**
398
+ *
399
+ * Return the boolean to check if show label on color swatches is enabled in General Settings page
400
+ *
401
+ * @return bool
402
+ */
403
+ public function is_show_label_enabled() {
404
+ if ( isset( $this->generalSettings['show-label-on-color-swatches'] ) && $this->generalSettings['show-label-on-color-swatches'] == 1 && TA_WC_Variation_Swatches::is_pro_addon_active() ) {
405
+ return true;
406
+ } else {
407
+ return false;
408
+ }
409
+ }
410
 
411
  /**
412
  * Render the tooltip html if it is enabled
includes/class-setting-fields-manager.php CHANGED
@@ -100,6 +100,22 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
100
  'show_if_checked' => true,
101
  'priority' => 1.1
102
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  array(
104
  'title' => __( 'Enable Image Swatches', 'wcvs' ),
105
  'fields' => array(
@@ -172,6 +188,18 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
172
  'desc' => __( 'Automatically covert dropdowns to &#34;Image Swatch&#34; if variation has an image.', 'wcvs' ),
173
  'priority' => 3
174
  ),
 
 
 
 
 
 
 
 
 
 
 
 
175
  array(
176
  'title' => __( 'Choose your swatch shape', 'wcvs' ),
177
  'fields' => array(
@@ -257,6 +285,26 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
257
  'desc' => __( 'It will be applied to the swatch image only.<br><i><u>Note:</u></i> <b>Swatch Height</b> in <b>Design</b> tab will be ignored.', 'wcvs' ),
258
  'priority' => 5.1
259
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  array(
261
  'title' => __( 'Disable Default Plugin Stylesheet', 'wcvs' ),
262
  'fields' => array(
@@ -416,25 +464,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
416
  'id' => 'wcvs-mar-top',
417
  'type' => 'number',
418
  'name' => 'mar-top',
419
- 'default_value' => '0'
 
420
  ),
421
  array(
422
  'id' => 'wcvs-mar-right',
423
  'type' => 'number',
424
  'name' => 'mar-right',
425
- 'default_value' => '15'
 
426
  ),
427
  array(
428
  'id' => 'wcvs-mar-bottom',
429
  'type' => 'number',
430
  'name' => 'mar-bottom',
431
- 'default_value' => '15'
 
432
  ),
433
  array(
434
  'id' => 'wcvs-mar-left',
435
  'type' => 'number',
436
  'name' => 'mar-left',
437
- 'default_value' => '0'
 
438
  ),
439
  array(
440
  'id' => 'wcvs-mar-type',
@@ -470,25 +522,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
470
  'id' => 'wcvs-pad-top',
471
  'type' => 'number',
472
  'name' => 'pad-top',
473
- 'default_value' => '0'
 
474
  ),
475
  array(
476
  'id' => 'wcvs-pad-right',
477
  'type' => 'number',
478
  'name' => 'pad-right',
479
- 'default_value' => '0'
 
480
  ),
481
  array(
482
  'id' => 'wcvs-pad-bottom',
483
  'type' => 'number',
484
  'name' => 'pad-bottom',
485
- 'default_value' => '0'
 
486
  ),
487
  array(
488
  'id' => 'wcvs-pad-left',
489
  'type' => 'number',
490
  'name' => 'pad-left',
491
- 'default_value' => '0'
 
492
  ),
493
  array(
494
  'id' => 'wcvs-pad-type',
@@ -524,25 +580,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
524
  'id' => 'wcvs-wrm-top',
525
  'type' => 'number',
526
  'name' => 'wrm-top',
527
- 'default_value' => '0'
 
528
  ),
529
  array(
530
  'id' => 'wcvs-wrm-right',
531
  'type' => 'number',
532
  'name' => 'wrm-right',
533
- 'default_value' => '15'
 
534
  ),
535
  array(
536
  'id' => 'wcvs-wrm-bottom',
537
  'type' => 'number',
538
  'name' => 'wrm-bottom',
539
- 'default_value' => '15'
 
540
  ),
541
  array(
542
  'id' => 'wcvs-wrm-left',
543
  'type' => 'number',
544
  'name' => 'wrm-left',
545
- 'default_value' => '0'
 
546
  ),
547
  array(
548
  'id' => 'wcvs-wrm-type',
@@ -578,25 +638,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
578
  'id' => 'wcvs-wrp-top',
579
  'type' => 'number',
580
  'name' => 'wrp-top',
581
- 'default_value' => '0'
 
582
  ),
583
  array(
584
  'id' => 'wcvs-wrp-right',
585
  'type' => 'number',
586
  'name' => 'wrp-right',
587
- 'default_value' => '0'
 
588
  ),
589
  array(
590
  'id' => 'wcvs-wrp-bottom',
591
  'type' => 'number',
592
  'name' => 'wrp-bottom',
593
- 'default_value' => '0'
 
594
  ),
595
  array(
596
  'id' => 'wcvs-wrp-left',
597
  'type' => 'number',
598
  'name' => 'wrp-left',
599
- 'default_value' => '0'
 
600
  ),
601
  array(
602
  'id' => 'wcvs-wrp-type',
@@ -756,25 +820,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
756
  'id' => 'wcvs-mar-top',
757
  'type' => 'number',
758
  'name' => 'mar-top',
759
- 'default_value' => '0'
 
760
  ),
761
  array(
762
  'id' => 'wcvs-mar-right',
763
  'type' => 'number',
764
  'name' => 'mar-right',
765
- 'default_value' => '15'
 
766
  ),
767
  array(
768
  'id' => 'wcvs-mar-bottom',
769
  'type' => 'number',
770
  'name' => 'mar-bottom',
771
- 'default_value' => '15'
 
772
  ),
773
  array(
774
  'id' => 'wcvs-mar-left',
775
  'type' => 'number',
776
  'name' => 'mar-left',
777
- 'default_value' => '0'
 
778
  ),
779
  array(
780
  'id' => 'wcvs-mar-type',
@@ -810,25 +878,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
810
  'id' => 'wcvs-pad-top',
811
  'type' => 'number',
812
  'name' => 'pad-top',
813
- 'default_value' => '0'
 
814
  ),
815
  array(
816
  'id' => 'wcvs-pad-right',
817
  'type' => 'number',
818
  'name' => 'pad-right',
819
- 'default_value' => '0'
 
820
  ),
821
  array(
822
  'id' => 'wcvs-pad-bottom',
823
  'type' => 'number',
824
  'name' => 'pad-bottom',
825
- 'default_value' => '0'
 
826
  ),
827
  array(
828
  'id' => 'wcvs-pad-left',
829
  'type' => 'number',
830
  'name' => 'pad-left',
831
- 'default_value' => '0'
 
832
  ),
833
  array(
834
  'id' => 'wcvs-pad-type',
@@ -864,25 +936,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
864
  'id' => 'wcvs-wrm-top',
865
  'type' => 'number',
866
  'name' => 'wrm-top',
867
- 'default_value' => '0'
 
868
  ),
869
  array(
870
  'id' => 'wcvs-wrm-right',
871
  'type' => 'number',
872
  'name' => 'wrm-right',
873
- 'default_value' => '15'
 
874
  ),
875
  array(
876
  'id' => 'wcvs-wrm-bottom',
877
  'type' => 'number',
878
  'name' => 'wrm-bottom',
879
- 'default_value' => '15'
 
880
  ),
881
  array(
882
  'id' => 'wcvs-wrm-left',
883
  'type' => 'number',
884
  'name' => 'wrm-left',
885
- 'default_value' => '0'
 
886
  ),
887
  array(
888
  'id' => 'wcvs-wrm-type',
@@ -918,25 +994,29 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Manager' ) ) {
918
  'id' => 'wcvs-wrp-top',
919
  'type' => 'number',
920
  'name' => 'wrp-top',
921
- 'default_value' => '0'
 
922
  ),
923
  array(
924
  'id' => 'wcvs-wrp-right',
925
  'type' => 'number',
926
  'name' => 'wrp-right',
927
- 'default_value' => '0'
 
928
  ),
929
  array(
930
  'id' => 'wcvs-wrp-bottom',
931
  'type' => 'number',
932
  'name' => 'wrp-bottom',
933
- 'default_value' => '0'
 
934
  ),
935
  array(
936
  'id' => 'wcvs-wrp-left',
937
  'type' => 'number',
938
  'name' => 'wrp-left',
939
- 'default_value' => '0'
 
940
  ),
941
  array(
942
  'id' => 'wcvs-wrp-type',
100
  'show_if_checked' => true,
101
  'priority' => 1.1
102
  ),
103
+ array(
104
+ 'title' => __( 'Show label inside swatches', 'wcvs' ),
105
+ 'fields' => array(
106
+ array(
107
+ 'id' => 'wcvs-show-label-on-color-swatches',
108
+ 'type' => 'checkbox',
109
+ 'name' => 'show-label-on-color-swatches',
110
+ )
111
+ ),
112
+ 'class' => 'indent',
113
+ 'field_to_check' => 'wcvs-enable-color-swatches',
114
+ 'desc' => __( 'Show the label for color swatches', 'wcvs' ),
115
+ 'show_if_checked' => true,
116
+ 'priority' => 1.2,
117
+ 'is_pro_feature' => true,
118
+ ),
119
  array(
120
  'title' => __( 'Enable Image Swatches', 'wcvs' ),
121
  'fields' => array(
188
  'desc' => __( 'Automatically covert dropdowns to &#34;Image Swatch&#34; if variation has an image.', 'wcvs' ),
189
  'priority' => 3
190
  ),
191
+ array(
192
+ 'title' => __( 'Disable checking the variation product availability', 'wcvs' ),
193
+ 'fields' => array(
194
+ array(
195
+ 'id' => 'wcvs-disable-checking-availability',
196
+ 'type' => 'checkbox',
197
+ 'name' => 'disable-checking-availability',
198
+ )
199
+ ),
200
+ 'desc' => __( 'All variations will be shown as available to select.', 'wcvs' ),
201
+ 'priority' => 4.1
202
+ ),
203
  array(
204
  'title' => __( 'Choose your swatch shape', 'wcvs' ),
205
  'fields' => array(
285
  'desc' => __( 'It will be applied to the swatch image only.<br><i><u>Note:</u></i> <b>Swatch Height</b> in <b>Design</b> tab will be ignored.', 'wcvs' ),
286
  'priority' => 5.1
287
  ),
288
+ array(
289
+ 'title' => __( 'Image position', 'woosuite-variation-swatches-pro' ),
290
+ 'fields' => array(
291
+ array(
292
+ 'id' => 'wcvs-image-position-pro',
293
+ 'type' => 'select',
294
+ 'options_group' => array(
295
+ array(
296
+ 'value' => 'default',
297
+ 'label' => __( 'Default', 'woosuite-variation-swatches-pro' ),
298
+ )
299
+ ),
300
+ 'class' => 'br-type',
301
+ 'name' => 'image-position',
302
+ )
303
+ ),
304
+ 'desc' => __( 'Select option', 'woosuite-variation-swatches-pro' ),
305
+ 'priority' => 5.2,
306
+ 'is_pro_feature' => true,
307
+ ),
308
  array(
309
  'title' => __( 'Disable Default Plugin Stylesheet', 'wcvs' ),
310
  'fields' => array(
464
  'id' => 'wcvs-mar-top',
465
  'type' => 'number',
466
  'name' => 'mar-top',
467
+ 'default_value' => '0',
468
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
469
  ),
470
  array(
471
  'id' => 'wcvs-mar-right',
472
  'type' => 'number',
473
  'name' => 'mar-right',
474
+ 'default_value' => '15',
475
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
476
  ),
477
  array(
478
  'id' => 'wcvs-mar-bottom',
479
  'type' => 'number',
480
  'name' => 'mar-bottom',
481
+ 'default_value' => '15',
482
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
483
  ),
484
  array(
485
  'id' => 'wcvs-mar-left',
486
  'type' => 'number',
487
  'name' => 'mar-left',
488
+ 'default_value' => '0',
489
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
490
  ),
491
  array(
492
  'id' => 'wcvs-mar-type',
522
  'id' => 'wcvs-pad-top',
523
  'type' => 'number',
524
  'name' => 'pad-top',
525
+ 'default_value' => '0',
526
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
527
  ),
528
  array(
529
  'id' => 'wcvs-pad-right',
530
  'type' => 'number',
531
  'name' => 'pad-right',
532
+ 'default_value' => '0',
533
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
534
  ),
535
  array(
536
  'id' => 'wcvs-pad-bottom',
537
  'type' => 'number',
538
  'name' => 'pad-bottom',
539
+ 'default_value' => '0',
540
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
541
  ),
542
  array(
543
  'id' => 'wcvs-pad-left',
544
  'type' => 'number',
545
  'name' => 'pad-left',
546
+ 'default_value' => '0',
547
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
548
  ),
549
  array(
550
  'id' => 'wcvs-pad-type',
580
  'id' => 'wcvs-wrm-top',
581
  'type' => 'number',
582
  'name' => 'wrm-top',
583
+ 'default_value' => '0',
584
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
585
  ),
586
  array(
587
  'id' => 'wcvs-wrm-right',
588
  'type' => 'number',
589
  'name' => 'wrm-right',
590
+ 'default_value' => '15',
591
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
592
  ),
593
  array(
594
  'id' => 'wcvs-wrm-bottom',
595
  'type' => 'number',
596
  'name' => 'wrm-bottom',
597
+ 'default_value' => '15',
598
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
599
  ),
600
  array(
601
  'id' => 'wcvs-wrm-left',
602
  'type' => 'number',
603
  'name' => 'wrm-left',
604
+ 'default_value' => '0',
605
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
606
  ),
607
  array(
608
  'id' => 'wcvs-wrm-type',
638
  'id' => 'wcvs-wrp-top',
639
  'type' => 'number',
640
  'name' => 'wrp-top',
641
+ 'default_value' => '0',
642
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
643
  ),
644
  array(
645
  'id' => 'wcvs-wrp-right',
646
  'type' => 'number',
647
  'name' => 'wrp-right',
648
+ 'default_value' => '0',
649
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
650
  ),
651
  array(
652
  'id' => 'wcvs-wrp-bottom',
653
  'type' => 'number',
654
  'name' => 'wrp-bottom',
655
+ 'default_value' => '0',
656
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
657
  ),
658
  array(
659
  'id' => 'wcvs-wrp-left',
660
  'type' => 'number',
661
  'name' => 'wrp-left',
662
+ 'default_value' => '0',
663
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
664
  ),
665
  array(
666
  'id' => 'wcvs-wrp-type',
820
  'id' => 'wcvs-mar-top',
821
  'type' => 'number',
822
  'name' => 'mar-top',
823
+ 'default_value' => '0',
824
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
825
  ),
826
  array(
827
  'id' => 'wcvs-mar-right',
828
  'type' => 'number',
829
  'name' => 'mar-right',
830
+ 'default_value' => '15',
831
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
832
  ),
833
  array(
834
  'id' => 'wcvs-mar-bottom',
835
  'type' => 'number',
836
  'name' => 'mar-bottom',
837
+ 'default_value' => '15',
838
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
839
  ),
840
  array(
841
  'id' => 'wcvs-mar-left',
842
  'type' => 'number',
843
  'name' => 'mar-left',
844
+ 'default_value' => '0',
845
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
846
  ),
847
  array(
848
  'id' => 'wcvs-mar-type',
878
  'id' => 'wcvs-pad-top',
879
  'type' => 'number',
880
  'name' => 'pad-top',
881
+ 'default_value' => '0',
882
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
883
  ),
884
  array(
885
  'id' => 'wcvs-pad-right',
886
  'type' => 'number',
887
  'name' => 'pad-right',
888
+ 'default_value' => '0',
889
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
890
  ),
891
  array(
892
  'id' => 'wcvs-pad-bottom',
893
  'type' => 'number',
894
  'name' => 'pad-bottom',
895
+ 'default_value' => '0',
896
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
897
  ),
898
  array(
899
  'id' => 'wcvs-pad-left',
900
  'type' => 'number',
901
  'name' => 'pad-left',
902
+ 'default_value' => '0',
903
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
904
  ),
905
  array(
906
  'id' => 'wcvs-pad-type',
936
  'id' => 'wcvs-wrm-top',
937
  'type' => 'number',
938
  'name' => 'wrm-top',
939
+ 'default_value' => '0',
940
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
941
  ),
942
  array(
943
  'id' => 'wcvs-wrm-right',
944
  'type' => 'number',
945
  'name' => 'wrm-right',
946
+ 'default_value' => '15',
947
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
948
  ),
949
  array(
950
  'id' => 'wcvs-wrm-bottom',
951
  'type' => 'number',
952
  'name' => 'wrm-bottom',
953
+ 'default_value' => '15',
954
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
955
  ),
956
  array(
957
  'id' => 'wcvs-wrm-left',
958
  'type' => 'number',
959
  'name' => 'wrm-left',
960
+ 'default_value' => '0',
961
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
962
  ),
963
  array(
964
  'id' => 'wcvs-wrm-type',
994
  'id' => 'wcvs-wrp-top',
995
  'type' => 'number',
996
  'name' => 'wrp-top',
997
+ 'default_value' => '0',
998
+ 'html_before' => '<span class="sw-input-type-icon">&uarr;</span>'
999
  ),
1000
  array(
1001
  'id' => 'wcvs-wrp-right',
1002
  'type' => 'number',
1003
  'name' => 'wrp-right',
1004
+ 'default_value' => '0',
1005
+ 'html_before' => '<span class="sw-input-type-icon">&rarr;</span>'
1006
  ),
1007
  array(
1008
  'id' => 'wcvs-wrp-bottom',
1009
  'type' => 'number',
1010
  'name' => 'wrp-bottom',
1011
+ 'default_value' => '0',
1012
+ 'html_before' => '<span class="sw-input-type-icon">&darr;</span>'
1013
  ),
1014
  array(
1015
  'id' => 'wcvs-wrp-left',
1016
  'type' => 'number',
1017
  'name' => 'wrp-left',
1018
+ 'default_value' => '0',
1019
+ 'html_before' => '<span class="sw-input-type-icon">&larr;</span>'
1020
  ),
1021
  array(
1022
  'id' => 'wcvs-wrp-type',
includes/class-setting-fields-renderer.php CHANGED
@@ -141,6 +141,7 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Renderer' ) ) {
141
  'custom_item_class' => '',
142
  'field_to_check' => '',
143
  'placeholder' => '',
 
144
  'html_after' => '',
145
  'html' => '',
146
  'min' => 0,
@@ -342,7 +343,10 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Renderer' ) ) {
342
  $field_name = $this->get_field_name( $args );
343
  ob_start();
344
  echo empty( $args['html_after'] ) ? '' : '<div class="field-with-html-after">';
345
- ?>
 
 
 
346
  <input type="number"
347
  name="<?php echo $field_name; ?>"
348
  class="<?php echo esc_attr( $args['custom_item_class'] ); ?>"
@@ -353,6 +357,7 @@ if ( ! class_exists( 'VSWC_Setting_Fields_Renderer' ) ) {
353
  placeholder="<?php echo esc_attr( $args['placeholder'] ); ?>"
354
  value="<?php echo $field_value; ?>">
355
  <?php
 
356
  echo empty( $args['html_after'] ) ? '' : $args['html_after'] . '</div>';
357
 
358
  return ob_get_clean();
141
  'custom_item_class' => '',
142
  'field_to_check' => '',
143
  'placeholder' => '',
144
+ 'html_before' => '',
145
  'html_after' => '',
146
  'html' => '',
147
  'min' => 0,
343
  $field_name = $this->get_field_name( $args );
344
  ob_start();
345
  echo empty( $args['html_after'] ) ? '' : '<div class="field-with-html-after">';
346
+ echo empty( $args['html_before'] ) ? '' : '<div class="field-with-html-before">';
347
+
348
+ echo empty( $args['html_before'] ) ? '' : $args['html_before'];
349
+ ?>
350
  <input type="number"
351
  name="<?php echo $field_name; ?>"
352
  class="<?php echo esc_attr( $args['custom_item_class'] ); ?>"
357
  placeholder="<?php echo esc_attr( $args['placeholder'] ); ?>"
358
  value="<?php echo $field_value; ?>">
359
  <?php
360
+ echo empty( $args['html_before'] ) ? '' : '</div>';
361
  echo empty( $args['html_after'] ) ? '' : $args['html_after'] . '</div>';
362
 
363
  return ob_get_clean();
includes/class-variation-swatches.php CHANGED
@@ -188,7 +188,7 @@ final class TA_WC_Variation_Swatches {
188
  } else {
189
  $field_value = isset( $current_options[ $section_id ][ $field_name . '-' . $att->attribute_name ] ) ? $current_options[ $section_id ][ $field_name . '-' . $att->attribute_name ] : '';
190
  }
191
- $field_id = $field_name . '-' . $att->attribute_name;
192
  $field_name_modified = $field_name_prefix . '[' . $field_name . '-' . $att->attribute_name . ']';
193
 
194
  $tax_slug = esc_attr( wc_attribute_taxonomy_name( $att->attribute_name ) );
@@ -223,7 +223,7 @@ final class TA_WC_Variation_Swatches {
223
  return array();
224
  }
225
  $collected_variations = array();
226
- $variations = self::get_available_variations( $product );
227
 
228
  if ( ! empty( $variations ) ) {
229
  foreach ( $variations as $variation ) {
@@ -245,7 +245,7 @@ final class TA_WC_Variation_Swatches {
245
  *
246
  * @return array[]|WC_Product_Variation[]
247
  */
248
- public static function get_available_variations( $product ) {
249
  if ( ! $product instanceof WC_Product_Variable ) {
250
  return array();
251
  }
@@ -264,7 +264,7 @@ final class TA_WC_Variation_Swatches {
264
  $variation = wc_get_product( $variation_id );
265
 
266
  // Hide out of stock variations if 'Hide out of stock items from the catalog' is checked.
267
- if ( ! $variation || ! $variation->exists() ) {
268
  continue;
269
  }
270
 
@@ -273,11 +273,14 @@ final class TA_WC_Variation_Swatches {
273
  $variation ) && ! $variation->variation_is_visible() ) {
274
  continue;
275
  }
276
-
277
- $available_variations[] = array(
278
- 'attributes' => $variation->get_variation_attributes(),
279
- 'variation_id' => $variation_id
280
- );
 
 
 
281
  }
282
 
283
  return array_values( array_filter( $available_variations ) );
188
  } else {
189
  $field_value = isset( $current_options[ $section_id ][ $field_name . '-' . $att->attribute_name ] ) ? $current_options[ $section_id ][ $field_name . '-' . $att->attribute_name ] : '';
190
  }
191
+ $field_id = $field_name . '-' . $att->attribute_name;
192
  $field_name_modified = $field_name_prefix . '[' . $field_name . '-' . $att->attribute_name . ']';
193
 
194
  $tax_slug = esc_attr( wc_attribute_taxonomy_name( $att->attribute_name ) );
223
  return array();
224
  }
225
  $collected_variations = array();
226
+ $variations = self::get_available_variations( $product );
227
 
228
  if ( ! empty( $variations ) ) {
229
  foreach ( $variations as $variation ) {
245
  *
246
  * @return array[]|WC_Product_Variation[]
247
  */
248
+ public static function get_available_variations( $product, $ignore_out_of_stock = false, $get_full_attribute_data = false ) {
249
  if ( ! $product instanceof WC_Product_Variable ) {
250
  return array();
251
  }
264
  $variation = wc_get_product( $variation_id );
265
 
266
  // Hide out of stock variations if 'Hide out of stock items from the catalog' is checked.
267
+ if ( ! $variation || ! $variation->exists() || ( $ignore_out_of_stock && ! $variation->is_in_stock() ) ) {
268
  continue;
269
  }
270
 
273
  $variation ) && ! $variation->variation_is_visible() ) {
274
  continue;
275
  }
276
+ if ( $get_full_attribute_data ) {
277
+ $available_variations[] = $product->get_available_variation( $variation_id );
278
+ } else {
279
+ $available_variations[] = array(
280
+ 'attributes' => $variation->get_variation_attributes(),
281
+ 'variation_id' => $variation_id,
282
+ );
283
+ }
284
  }
285
 
286
  return array_values( array_filter( $available_variations ) );
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: variationswatches, themealien, zgani, mehbubrashid, minhnguyen25
3
  Tags: variation swatches, woocommerce, product attribute, product color, product size, variable products
4
  Requires at least: 4.5
5
  Tested up to: 5.8.2
6
- Stable tag: 2.1.2
7
  WC requires at least: 3.2.0
8
- WC tested up to: 5.9.0
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -53,7 +53,7 @@ If you like this WordPress popup plugin, then consider checking out our other pr
53
  * <a href="https://woosuite.com/plugins/sales-agent-reps/">Sales Agents for WooCommerce</a> - Grow your business by adding sale agents to your WooCommerce store.
54
 
55
 
56
- Visit <a href="https://woosuite.com/blog/" rel="friend" title="WPBeginner">the Woosuite blog</a> to learn from our <a href="https://woosuite.com/woocommerce/" rel="friend" title="WooCommerce Tutorials">WordPress Tutorials</a> and find out about other <a href="https://woosuite.com/plugins/" rel="friend" title="Best WordPress Plugins">WooCommerce plugins</a>.
57
 
58
 
59
  == Installation ==
@@ -103,6 +103,14 @@ Yes, it will work with any theme, but may require some styling to make it match
103
  7. Add new attribute color when edit a product
104
 
105
  == Changelog ==
 
 
 
 
 
 
 
 
106
  = 2.1.2 =
107
  * Remove inline styles when disable plugin styling is active
108
  * Remove unnecessary data when getting the product variation
3
  Tags: variation swatches, woocommerce, product attribute, product color, product size, variable products
4
  Requires at least: 4.5
5
  Tested up to: 5.8.2
6
+ Stable tag: 2.1.3
7
  WC requires at least: 3.2.0
8
+ WC tested up to: 6.0.0
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
53
  * <a href="https://woosuite.com/plugins/sales-agent-reps/">Sales Agents for WooCommerce</a> - Grow your business by adding sale agents to your WooCommerce store.
54
 
55
 
56
+ Visit <a href="https://woosuite.com/blog/" rel="friend">the Woosuite blog</a> to learn from our <a href="https://woosuite.com/woocommerce/" rel="friend" title="WooCommerce Tutorials">WordPress Tutorials</a> and find out about other <a href="https://woosuite.com/plugins/" rel="friend" title="Best WordPress Plugins">WooCommerce plugins</a>.
57
 
58
 
59
  == Installation ==
103
  7. Add new attribute color when edit a product
104
 
105
  == Changelog ==
106
+ = 2.1.3 =
107
+ * Fixed firefox showing unavailable sizes
108
+ * Create option for image position for swatches
109
+ * Added arrows for the margin and padding setting fields
110
+ * Fix swatches not resetting appearance on click event
111
+ * Add option to use variable image only
112
+ * Add an option to disable checking variation availability
113
+
114
  = 2.1.2 =
115
  * Remove inline styles when disable plugin styling is active
116
  * Remove unnecessary data when getting the product variation
templates/admin/welcome-popup.php CHANGED
@@ -6,10 +6,10 @@
6
  </div>
7
  <div class="popup-content">
8
  <div class="popup-inner-content">
9
- <p><strong>Congratulations on updating to v2.1.2!</strong></p>
10
- <p>We’ve been quiet on this end for several days as we’ve been hard at work making our plugin even better for you…</p>
11
  <p>Based on your feedback, we have added a bunch of new features and enhancements with a lot more to go.</p>
12
- <p><a href="https://woosuite.com/news/variation-swatches-v2-1-2-update/" target="_blank" rel="noopener noreferrer nofollow"> Click here to learn more. </a></p>
13
  <p>If you experience any issues, please get in touch with support so we can make it right: <a href="https://woosuite.com/support/" target="_blank" rel="noopener noreferrer nofollow">Support</a></p>
14
  </div>
15
  </div>
6
  </div>
7
  <div class="popup-content">
8
  <div class="popup-inner-content">
9
+ <p><strong>Congratulations on updating to v2.1.3!</strong></p>
10
+ <p>And Happy New Year🎉 We’ve been quiet on this end for several weeks as we’ve been hard at work making our plugin even better for you…</p>
11
  <p>Based on your feedback, we have added a bunch of new features and enhancements with a lot more to go.</p>
12
+ <p><a href="https://woosuite.com/news/variation-swatches-updates/" target="_blank" rel="noopener noreferrer nofollow"> Click here to learn more. </a></p>
13
  <p>If you experience any issues, please get in touch with support so we can make it right: <a href="https://woosuite.com/support/" target="_blank" rel="noopener noreferrer nofollow">Support</a></p>
14
  </div>
15
  </div>
variation-swatches-for-woocommerce.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Variation Swatches for WooCommerce
4
  * Plugin URI: https://woosuite.com/plugins/woocommerce-variation-swatches/
5
  * Description: Creates variation swatches for WooCommerce, converts your variation dropdown into color, label, or photo swatches with ease, The original Variation Swatches for WooCommerce.
6
- * Version: 2.1.2
7
  * Author: Woosuite
8
  * Author URI: https://woosuite.com/
9
  * Requires at least: 4.5
@@ -11,7 +11,7 @@
11
  * Text Domain: wcvs
12
  * Domain Path: /languages
13
  * WC requires at least: 3.0.0
14
- * WC tested up to: 5.9.0
15
  *
16
  * License: GPLv2 or later
17
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -27,7 +27,7 @@ if ( ! defined( 'TAWC_VS_PLUGIN_FILE' ) ) {
27
  }
28
 
29
  if ( ! defined( 'WCVS_PLUGIN_VERSION' ) ) {
30
- define( 'WCVS_PLUGIN_VERSION', '2.1.2' );
31
  }
32
 
33
  if ( ! defined( 'WCVS_PLUGIN_URL' ) ) {
3
  * Plugin Name: Variation Swatches for WooCommerce
4
  * Plugin URI: https://woosuite.com/plugins/woocommerce-variation-swatches/
5
  * Description: Creates variation swatches for WooCommerce, converts your variation dropdown into color, label, or photo swatches with ease, The original Variation Swatches for WooCommerce.
6
+ * Version: 2.1.3
7
  * Author: Woosuite
8
  * Author URI: https://woosuite.com/
9
  * Requires at least: 4.5
11
  * Text Domain: wcvs
12
  * Domain Path: /languages
13
  * WC requires at least: 3.0.0
14
+ * WC tested up to: 6.0.0
15
  *
16
  * License: GPLv2 or later
17
  * License URI: https://www.gnu.org/licenses/gpl-2.0.html
27
  }
28
 
29
  if ( ! defined( 'WCVS_PLUGIN_VERSION' ) ) {
30
+ define( 'WCVS_PLUGIN_VERSION', '2.1.3' );
31
  }
32
 
33
  if ( ! defined( 'WCVS_PLUGIN_URL' ) ) {