WooCommerce Advanced Free Shipping - Version 1.1.4

Version Description

  • 10-04-2018 =

  • [Improvement] - Improved mobile admin view

  • [Improvement] - Update WP Conditions to 1.0.8

  • [Fix] - Error message on debug mode when creating a new shipping rate

Download this release

Release Info

Developer sormano
Plugin Icon 128x128 WooCommerce Advanced Free Shipping
Version 1.1.4
Comparing to
See all releases

Code changes from version 1.1.3 to 1.1.4

assets/css/woocommerce-advanced-free-shipping.min.css CHANGED
@@ -1 +1,3 @@
1
- .wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px );height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:'dashicons';content:"\f502";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:'dashicons';content:"\f460";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .wpc-value.select2-container{display:inline-block !important;margin:1px}.wpc-condition-wrap .wpc-value.select2-container.select2-container-active .select2-choice{border:1px solid #666}.wpc-condition-wrap .wpc-value.select2-container.select2-drop-above .select2-choice{border-radius:0 0 4px 4px;border:1px solid #666;border-top-color:transparent}.wpc-condition-wrap .wpc-value.select2-container .select2-choice{border-color:#ddd;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;height:26px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.07);box-shadow:inset 0 1px 2px rgba(0,0,0,0.07)}.wpc-condition-wrap .wpc-value.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;border-bottom-left-radius:0;border-bottom-right-radius:0;border:1px solid #666;outline:0}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px !important}.wpc-condition-wrap .select2-container .select2-selection--single #select2--container,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{height:28px}.wpc-conditions-post-table .sort{padding:0 4px;cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"\e032";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:"\e007"}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:27px;box-sizing:border-box;color:#555;text-align:center;background-color:#EEE;border:1px solid #DDD;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}.post-type-wafs .misc-pub-visibility#visibility{display:none}.wafs-option label{display:inline-block;width:150px}.wafs_conditions_meta_box>p:first-child+div>.or_match{display:none}.wafs_desc{display:none;position:absolute;background:rgba(0,0,0,0.8);min-width:25px;max-width:200px;border-radius:6px;padding:5px 10px;color:white;margin-top:10px;right:40px;text-align:center}.wafs_desc:after{border-top:0px solid transparent;border-right:10px solid transparent;border-left:10px solid transparent;border-bottom:10px solid rgba(0,0,0,0.8);content:' ';position:absolute;top:-10px;right:10px;z-index:999}.wafs_tip:hover ~ .wafs_desc{display:block !important}.wafs-description{width:40px;float:right;line-height:20px}.condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wafs-condition-wrap:hover .condition-delete{display:inline-block;opacity:1}#advanced_free_shipping_shipping_methods tr .row-actions{visibility:hidden}#advanced_free_shipping_shipping_methods tr:hover>td>.row-actions{visibility:visible !important}
 
 
1
+ .wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px);height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:'dashicons';content:"\f502";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:'dashicons';content:"\f460";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .select2-container{vertical-align:top}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px;margin:1px}.wpc-condition-wrap .select2-container .select2-selection--single #select2--container,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px;height:28px}@media screen and (max-width: 782px){.wpc-condition-wrap .select2-container .select2-selection--single{height:36px}.wpc-condition-wrap .select2-container .select2-selection--single #select2--container,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:36px;height:36px}}.wpc-condition-wrap .select2-container .select2-selection--multiple .select2-selection__choice{margin:4px 5px 0 0;line-height:12px;font-size:11px;font-weight:600}.wpc-condition-wrap .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#aaa}.wpc-condition-wrap .select2-container .select2-selection--multiple{line-height:0.7}.wpc-conditions-post-table .sort{padding:0 4px;cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"\e032";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:"\e007"}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:27px;box-sizing:border-box;color:#555;text-align:center;background-color:#EEE;border:1px solid #DDD;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}.post-type-wafs .misc-pub-visibility#visibility{display:none}.wafs-option label{display:inline-block;width:150px}.wafs_conditions_meta_box>p:first-child+div>.or_match{display:none}.wafs_desc{display:none;position:absolute;background:rgba(0,0,0,0.8);min-width:25px;max-width:200px;border-radius:6px;padding:5px 10px;color:white;margin-top:10px;right:40px;text-align:center}.wafs_desc:after{border-top:0px solid transparent;border-right:10px solid transparent;border-left:10px solid transparent;border-bottom:10px solid rgba(0,0,0,0.8);content:' ';position:absolute;top:-10px;right:10px;z-index:999}.wafs_tip:hover ~ .wafs_desc{display:block !important}.wafs-description{width:40px;float:right;line-height:20px}.condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wafs-condition-wrap:hover .condition-delete{display:inline-block;opacity:1}#advanced_free_shipping_shipping_methods tr .row-actions{visibility:hidden}#advanced_free_shipping_shipping_methods tr:hover>td>.row-actions{visibility:visible !important}
2
+
3
+ /*# sourceMappingURL=woocommerce-advanced-free-shipping.min.css.map */
includes/admin/views/conditions-table.php CHANGED
@@ -22,7 +22,7 @@ $shipping_rates = wafs_get_rates( array( 'post_status' => array( 'draft', 'publi
22
  <table class='wp-list-table wpc-conditions-post-table wpc-sortable-post-table widefat'>
23
  <thead>
24
  <tr>
25
- <th style='padding-left: 10px;'><?php _e( 'Title', 'woocommerce-advanced-free-shipping' ); ?></th>
26
  <th style='padding-left: 10px;'><?php _e( 'Shipping title', 'woocommerce-advanced-free-shipping' ); ?></th>
27
  <th style='padding-left: 10px;'><?php _e( 'Condition groups', 'woocommerce-advanced-free-shipping' ); ?></th>
28
  </tr>
@@ -37,7 +37,7 @@ $shipping_rates = wafs_get_rates( array( 'post_status' => array( 'draft', 'publi
37
  $alt = ( $i++ ) % 2 == 0 ? 'alternate' : '';
38
 
39
  ?><tr class='<?php echo $alt; ?>'>
40
- <td>
41
  <strong>
42
  <a href='<?php echo get_edit_post_link( $post->ID ); ?>' class='row-title' title='<?php _e( 'Edit Method', 'woocommerce-advanced-fees' ); ?>'><?php
43
  echo _draft_or_post_title( $post->ID );
@@ -66,14 +66,14 @@ $shipping_rates = wafs_get_rates( array( 'post_status' => array( 'draft', 'publi
66
 
67
  if ( empty( $shipping_rates ) ) :
68
  ?><tr>
69
- <td colspan='2'><?php _e( 'There are no Free Shipping rates. Yet...', 'woocommerce-advanced-free-shipping' ); ?></td>
70
  </tr><?php
71
  endif;
72
 
73
  ?></tbody>
74
  <tfoot>
75
  <tr>
76
- <th colspan='4' style='padding-left: 10px;'>
77
  <a href='<?php echo admin_url( 'post-new.php?post_type=wafs' ); ?>' class='add button'><?php _e( 'Add Free Shipping rate', 'woocommerce-advanced-free-shipping' ); ?></a>
78
  </th>
79
  </tr>
22
  <table class='wp-list-table wpc-conditions-post-table wpc-sortable-post-table widefat'>
23
  <thead>
24
  <tr>
25
+ <th style='padding-left: 10px;' class="column-primary"><?php _e( 'Title', 'woocommerce-advanced-free-shipping' ); ?></th>
26
  <th style='padding-left: 10px;'><?php _e( 'Shipping title', 'woocommerce-advanced-free-shipping' ); ?></th>
27
  <th style='padding-left: 10px;'><?php _e( 'Condition groups', 'woocommerce-advanced-free-shipping' ); ?></th>
28
  </tr>
37
  $alt = ( $i++ ) % 2 == 0 ? 'alternate' : '';
38
 
39
  ?><tr class='<?php echo $alt; ?>'>
40
+ <td class="column-primary">
41
  <strong>
42
  <a href='<?php echo get_edit_post_link( $post->ID ); ?>' class='row-title' title='<?php _e( 'Edit Method', 'woocommerce-advanced-fees' ); ?>'><?php
43
  echo _draft_or_post_title( $post->ID );
66
 
67
  if ( empty( $shipping_rates ) ) :
68
  ?><tr>
69
+ <td colspan='2' style="display: table-cell;"><?php _e( 'There are no Free Shipping rates. Yet...', 'woocommerce-advanced-free-shipping' ); ?></td>
70
  </tr><?php
71
  endif;
72
 
73
  ?></tbody>
74
  <tfoot>
75
  <tr>
76
+ <th colspan='4' style='padding-left: 10px; display: table-cell;'>
77
  <a href='<?php echo admin_url( 'post-new.php?post_type=wafs' ); ?>' class='add button'><?php _e( 'Add Free Shipping rate', 'woocommerce-advanced-free-shipping' ); ?></a>
78
  </th>
79
  </tr>
includes/admin/views/meta-box-settings.php CHANGED
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
  wp_nonce_field( 'wafs_settings_meta_box', 'wafs_settings_meta_box_nonce' );
15
 
16
  global $post;
17
- $settings = get_post_meta( $post->ID, '_wafs_shipping_method', true );
18
  $settings['shipping_title'] = ! empty( $settings['shipping_title'] ) ? $settings['shipping_title'] : '';
19
 
20
  ?><div class='wafs wafs_settings wafs_meta_box wafs_settings_meta_box'>
14
  wp_nonce_field( 'wafs_settings_meta_box', 'wafs_settings_meta_box_nonce' );
15
 
16
  global $post;
17
+ $settings = (array) get_post_meta( $post->ID, '_wafs_shipping_method', true );
18
  $settings['shipping_title'] = ! empty( $settings['shipping_title'] ) ? $settings['shipping_title'] : '';
19
 
20
  ?><div class='wafs wafs_settings wafs_meta_box wafs_settings_meta_box'>
libraries/wp-conditions/admin-functions.php CHANGED
@@ -94,11 +94,11 @@ if ( ! function_exists( 'wpc_html_field' ) ) {
94
  foreach ( $options as $index => $values ) :
95
 
96
  if ( ! is_array( $values ) ) :
97
- ?><option value='<?php echo esc_attr( $index ); ?>' <?php selected( $index, $value ); ?>><?php echo esc_attr( $values ); ?></option><?php
98
  else :
99
  ?><optgroup label='<?php echo esc_attr( $index ); ?>'><?php
100
  foreach ( $values as $k => $v ) :
101
- ?><option value='<?php echo esc_attr( $k ); ?>' <?php selected( $k, $value ); ?>><?php echo esc_attr( $v ); ?></option><?php
102
  endforeach;
103
  ?></optgroup><?php
104
  endif;
94
  foreach ( $options as $index => $values ) :
95
 
96
  if ( ! is_array( $values ) ) :
97
+ ?><option value='<?php echo esc_attr( $index ); ?>' <?php selected( in_array( $index, (array) $value ) ); ?>><?php echo esc_attr( $values ); ?></option><?php
98
  else :
99
  ?><optgroup label='<?php echo esc_attr( $index ); ?>'><?php
100
  foreach ( $values as $k => $v ) :
101
+ ?><option value='<?php echo esc_attr( $k ); ?>' <?php selected( in_array( $k, (array) $value ) ); ?>><?php echo esc_attr( $v ); ?></option><?php
102
  endforeach;
103
  ?></optgroup><?php
104
  endif;
libraries/wp-conditions/assets/css/wp-conditions.min.css CHANGED
@@ -1 +1 @@
1
- .wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px );height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:'dashicons';content:"\f502";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:'dashicons';content:"\f460";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .wpc-value.select2-container{display:inline-block !important;margin:1px}.wpc-condition-wrap .wpc-value.select2-container.select2-container-active .select2-choice{border:1px solid #666}.wpc-condition-wrap .wpc-value.select2-container.select2-drop-above .select2-choice{border-radius:0 0 4px 4px;border:1px solid #666;border-top-color:transparent}.wpc-condition-wrap .wpc-value.select2-container .select2-choice{border-color:#ddd;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;height:26px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.07);box-shadow:inset 0 1px 2px rgba(0,0,0,0.07)}.wpc-condition-wrap .wpc-value.select2-dropdown-open .select2-choice{border-bottom-color:transparent;-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset;border-bottom-left-radius:0;border-bottom-right-radius:0;border:1px solid #666;outline:0}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px !important}.wpc-condition-wrap .select2-container .select2-selection--single #select2--container,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px}.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{height:28px}.wpc-conditions-post-table .sort{padding:0 4px;cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"\e032";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:"\e007"}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:27px;box-sizing:border-box;color:#555;text-align:center;background-color:#EEE;border:1px solid #DDD;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}
1
+ .wpc-condition-groups .wpc-condition-group{background-color:#f5f5f5;padding:15px;border:1px solid #e5e5e5;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.04);box-shadow:0 1px 1px rgba(0,0,0,0.04);min-height:30px;margin:0 -13px 1.5em}.wpc-condition-groups .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-condition-groups .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px);height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-condition-groups .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-condition-groups .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-condition-groups .wpc-add.button:before{font-family:'dashicons';content:"\f502";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;margin-right:5px;color:#667}.wpc-condition-groups .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-condition-groups .wpc-condition-delete.button:before{font-family:'dashicons';content:"\f460";vertical-align:middle;height:1.2em;line-height:1;display:inline-block;color:#667}.wpc-condition-groups>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-condition-groups .or-text{margin:1.5em 0}.wpc-condition-groups .match-text{margin:0 0 1em}.wpc-condition-groups .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-condition-groups .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-condition-groups .wpc-condition-wrap.loading{height:30px}.wpc-condition-groups .wpc-condition-wrap.loading .loading-icon{width:100%;clear:both;display:block;text-align:center;line-height:110%;margin:0 1px}.wpc-condition-wrap .select2-container{vertical-align:top}.wpc-condition-wrap .select2-container .select2-selection--single{height:28px;margin:1px}.wpc-condition-wrap .select2-container .select2-selection--single #select2--container,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:26px;height:28px}@media screen and (max-width: 782px){.wpc-condition-wrap .select2-container .select2-selection--single{height:36px}.wpc-condition-wrap .select2-container .select2-selection--single #select2--container,.wpc-condition-wrap .select2-container .select2-selection--single .select2-selection__arrow{line-height:36px;height:36px}}.wpc-condition-wrap .select2-container .select2-selection--multiple .select2-selection__choice{margin:4px 5px 0 0;line-height:12px;font-size:11px;font-weight:600}.wpc-condition-wrap .select2-container--default.select2-container--focus .select2-selection--multiple{border-color:#aaa}.wpc-condition-wrap .select2-container .select2-selection--multiple{line-height:0.7}.wpc-conditions-post-table .sort{padding:0 4px;cursor:move;text-align:center;vertical-align:middle}.wpc-conditions-post-table .sort:before{content:"\e032";font-family:WooCommerce;text-align:center;line-height:1;color:#999;display:block;width:100%;float:left;height:100%}.wpc-conditions-post-table .sort:before,.wpc-conditions-post-table .row-actions{visibility:hidden !important}.wpc-conditions-post-table tr:hover .sort:before,.wpc-conditions-post-table tr:hover>td>.row-actions{visibility:visible !important}.wpc-conditions-post-table .add.button:before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin-right:7px;content:"\e007"}@media screen and (max-width: 782px){.wpc-conditions-post-table th{padding:8px}.wpc-conditions-post-table td{padding:8px 10px}.wpc-conditions-post-table tfoot .button{margin-bottom:0}}.wpc-currency{padding:3px 10px;font-size:14px;font-weight:400;line-height:19px;height:27px;box-sizing:border-box;color:#555;text-align:center;background-color:#EEE;border:1px solid #DDD;border-right:none;border-radius:4px 0px 0px 4px;margin:1px 0px 1px 1px;display:inline-block}.wpc-currency+input{margin-left:-4px;line-height:19px;width:161px !important}@media screen and (max-width: 782px){.wpc-currency{font-size:16px;padding:6px 10px;height:33px}}
libraries/wp-conditions/assets/css/wp-conditions.scss CHANGED
@@ -155,47 +155,42 @@
155
  *************************************************************/
156
  .wpc-condition-wrap {
157
 
158
- .wpc-value.select2-container {
159
- display: inline-block !important;
160
- margin: 1px;
161
 
162
- &.select2-container-active .select2-choice {
163
- border: 1px solid #666;
 
 
 
 
 
 
 
164
  }
165
- &.select2-drop-above .select2-choice {
166
- border-radius: 0 0 4px 4px;
167
- border: 1px solid #666;
168
- border-top-color: rgba(0, 0, 0, 0);
 
 
 
 
 
 
169
  }
170
- .select2-choice {
171
- border-color: #ddd;
172
- -webkit-border-radius: 5px;
173
- -moz-border-radius: 5px;
174
- border-radius: 5px;
175
- height: 26px;
176
- -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
177
- box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.07);
178
  }
179
  }
180
- .wpc-value.select2-dropdown-open .select2-choice {
181
- border-bottom-color: rgba(0, 0, 0, 0);
182
- -webkit-box-shadow: 0 1px 0 #fff inset;
183
- box-shadow: 0 1px 0 #fff inset;
184
- border-bottom-left-radius: 0;
185
- border-bottom-right-radius: 0;
186
- border: 1px solid #666;
187
- outline: 0;
188
  }
189
-
190
- // WC 2.7+
191
- .select2-container .select2-selection--single {
192
- height: 28px !important;
193
-
194
- #select2--container,
195
- .select2-selection__arrow {
196
- line-height: 26px;
197
- }
198
- .select2-selection__arrow { height: 28px; }
199
  }
200
  }
201
 
155
  *************************************************************/
156
  .wpc-condition-wrap {
157
 
158
+ .select2-container {
159
+ vertical-align: top;
 
160
 
161
+ .select2-selection--single {
162
+ height: 28px;
163
+ margin: 1px;
164
+
165
+ #select2--container,
166
+ .select2-selection__arrow {
167
+ line-height: 26px;
168
+ height: 28px;
169
+ }
170
  }
171
+ @media screen and ( max-width: 782px ) {
172
+ .select2-selection--single {
173
+ height: 36px;
174
+
175
+ #select2--container,
176
+ .select2-selection__arrow {
177
+ line-height: 36px;
178
+ height: 36px;
179
+ }
180
+ }
181
  }
182
+ .select2-selection--multiple .select2-selection__choice {
183
+ margin: 4px 5px 0 0;
184
+ line-height: 12px;
185
+ font-size: 11px;
186
+ font-weight: 600;
 
 
 
187
  }
188
  }
189
+ .select2-container--default.select2-container--focus .select2-selection--multiple {
190
+ border-color: #aaa;
 
 
 
 
 
 
191
  }
192
+ .select2-container .select2-selection--multiple {
193
+ line-height: 0.7;
 
 
 
 
 
 
 
 
194
  }
195
  }
196
 
libraries/wp-conditions/assets/js/wp-conditions.js CHANGED
@@ -38,6 +38,9 @@ jQuery( function( $ ) {
38
  template.find( '.wpc-condition[data-id]' ).attr( 'data-id', function( index, value ) {
39
  return ( value.replace( '9999', new_id ) ) || value;
40
  });
 
 
 
41
  template.find( '[data-group]' ).attr( 'data-group', function( index, value ) {
42
  return ( value.replace( '9999', new_id ) ) || value;
43
  });
38
  template.find( '.wpc-condition[data-id]' ).attr( 'data-id', function( index, value ) {
39
  return ( value.replace( '9999', new_id ) ) || value;
40
  });
41
+ // Fix #20 - condition IDs being replaced by group IDs
42
+ template.find( '.wpc-condition-template .wpc-condition[data-id]' ).attr( 'data-id', '9999' );
43
+
44
  template.find( '[data-group]' ).attr( 'data-group', function( index, value ) {
45
  return ( value.replace( '9999', new_id ) ) || value;
46
  });
libraries/wp-conditions/assets/js/wp-conditions.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(function($){function t(){$(".wpc-conditions").repeater({addTrigger:".wpc-condition-group-add",removeTrigger:".wpc-condition-group .delete",template:".wpc-condition-group-template .wpc-condition-group-wrap",elementWrap:".wpc-condition-group-wrap",elementsContainer:".wpc-condition-groups",removeElement:function(t){t.remove()}})}function o(){$(".wpc-condition-group").repeater({addTrigger:".wpc-condition-add",removeTrigger:".wpc-condition-delete",template:".wpc-condition-template .wpc-condition-wrap",elementWrap:".wpc-condition-wrap",elementsContainer:".wpc-conditions-list"})}t(),o(),jQuery(document.body).on("repeater-added-row",function(t,e,n,i){var a=Math.floor(899999999*Math.random()+1e8);e.find("input[name], select[name]").attr("name",function(t,o){return o.replace("9999",a)||o}),e.find(".wpc-condition[data-id]").attr("data-id",function(t,o){return o.replace("9999",a)||o}),e.find("[data-group]").attr("data-group",function(t,o){return o.replace("9999",a)||o}),e.find(".repeater-active").removeClass("repeater-active"),o()}),$(document.body).on("click",".wpc-conditions .duplicate",function(){var t=$(this).parents(".wpc-condition-group-wrap"),e=t.find(".wpc-condition-group").attr("data-group"),n=$(this).parents(".wpc-condition-groups"),i=t.clone(),a=Math.floor(899999999*Math.random()+1e8);$(t).find("select").each(function(t){$(i).find("select").eq(t).val($(this).val())}),i.find(".wpc-condition-group").attr("data-group",a),i.find("input[name], select[name]").attr("name",function(t,o){return o.replace("conditions["+e+"]","conditions["+a+"]")}),i.find(".repeater-active").removeClass("repeater-active"),n.append(i),o(),$("html, body").on("scroll mousedown DOMMouseScroll mousewheel keydown touchmove",function(t){$("html, body").stop().off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")}),$("body, html").animate({scrollTop:$(i).offset().top-50},750,function(){$("html, body").off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")})}),$(document.body).on("change",".wpc-condition",function(){var t='<span style="width: calc( 42.5% - 75px ); border: 1px solid transparent; display: inline-block;">&nbsp;</span>',o={action:wpc2.action_prefix+"update_condition_value",id:$(this).attr("data-id"),group:$(this).parents(".wpc-condition-group").attr("data-group"),condition:$(this).val(),nonce:wpc.nonce},e=$(this).parents(".wpc-condition-wrap").first(),n=".wpc-value-field-wrap";e.find(n).html(t).block({message:null,overlayCSS:{background:"",opacity:.6}}),$.post(ajaxurl,o,function(t){e.find(n).replaceWith(t),$(document.body).trigger("wc-enhanced-select-init")});var i=e.find(".wpc-operator").val();e.find(".wpc-operator").empty().html(function(){var t=$(this),e=wpc.condition_operators[o.condition]||wpc.condition_operators["default"];$.each(e,function(o,e){t.append($("<option/>").attr("value",o).text(e)),t.val(i).val()||t.val(t.find("option:first").val())})}),e.find(".wpc-description").html(function(){return $('<span class="woocommerce-help-tip" />').attr("data-tip",wpc.condition_descriptions[o.condition]||"")}),$(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),$("#tiptip_holder").removeAttr("style"),$("#tiptip_arrow").removeAttr("style")}),$(".wpc-conditions-post-table.wpc-sortable-post-table tbody").sortable({items:"tr",handle:".sort",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(t,o){o.item.css("background-color","#f6f6f6")},stop:function(t,o){o.item.removeAttr("style")},update:function(t,o){$table=$(this).closest("table"),$table.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var e={action:"wpc_save_post_order",form:$(this).closest("form").serialize(),nonce:wpc.nonce};$.post(ajaxurl,e,function(t){$(".wpc-conditions-post-table tbody tr:even").addClass("alternate"),$(".wpc-conditions-post-table tbody tr:odd").removeClass("alternate"),$table.unblock()})}})});
1
+ jQuery(function($){function t(){$(".wpc-conditions").repeater({addTrigger:".wpc-condition-group-add",removeTrigger:".wpc-condition-group .delete",template:".wpc-condition-group-template .wpc-condition-group-wrap",elementWrap:".wpc-condition-group-wrap",elementsContainer:".wpc-condition-groups",removeElement:function(t){t.remove()}})}function o(){$(".wpc-condition-group").repeater({addTrigger:".wpc-condition-add",removeTrigger:".wpc-condition-delete",template:".wpc-condition-template .wpc-condition-wrap",elementWrap:".wpc-condition-wrap",elementsContainer:".wpc-conditions-list"})}t(),o(),jQuery(document.body).on("repeater-added-row",function(t,e,n,i){var a=Math.floor(899999999*Math.random()+1e8);e.find("input[name], select[name]").attr("name",function(t,o){return o.replace("9999",a)||o}),e.find(".wpc-condition[data-id]").attr("data-id",function(t,o){return o.replace("9999",a)||o}),e.find(".wpc-condition-template .wpc-condition[data-id]").attr("data-id","9999"),e.find("[data-group]").attr("data-group",function(t,o){return o.replace("9999",a)||o}),e.find(".repeater-active").removeClass("repeater-active"),o()}),$(document.body).on("click",".wpc-conditions .duplicate",function(){var t=$(this).parents(".wpc-condition-group-wrap"),e=t.find(".wpc-condition-group").attr("data-group"),n=$(this).parents(".wpc-condition-groups"),i=t.clone(),a=Math.floor(899999999*Math.random()+1e8);$(t).find("select").each(function(t){$(i).find("select").eq(t).val($(this).val())}),i.find(".wpc-condition-group").attr("data-group",a),i.find("input[name], select[name]").attr("name",function(t,o){return o.replace("conditions["+e+"]","conditions["+a+"]")}),i.find(".repeater-active").removeClass("repeater-active"),n.append(i),o(),$("html, body").on("scroll mousedown DOMMouseScroll mousewheel keydown touchmove",function(t){$("html, body").stop().off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")}),$("body, html").animate({scrollTop:$(i).offset().top-50},750,function(){$("html, body").off("scroll mousedown DOMMouseScroll mousewheel keydown touchmove")})}),$(document.body).on("change",".wpc-condition",function(){var t={action:wpc2.action_prefix+"update_condition_value",id:$(this).attr("data-id"),group:$(this).parents(".wpc-condition-group").attr("data-group"),condition:$(this).val(),nonce:wpc.nonce},o=$(this).parents(".wpc-condition-wrap").first(),e=".wpc-value-field-wrap";o.find(e).html('<span style="width: calc( 42.5% - 75px ); border: 1px solid transparent; display: inline-block;">&nbsp;</span>').block({message:null,overlayCSS:{background:"",opacity:.6}}),$.post(ajaxurl,t,function(t){o.find(e).replaceWith(t),$(document.body).trigger("wc-enhanced-select-init")});var n=o.find(".wpc-operator").val();o.find(".wpc-operator").empty().html(function(){var o=$(this),e=wpc.condition_operators[t.condition]||wpc.condition_operators.default;$.each(e,function(t,e){o.append($("<option/>").attr("value",t).text(e)),o.val(n).val()||o.val(o.find("option:first").val())})}),o.find(".wpc-description").html(function(){return $('<span class="woocommerce-help-tip" />').attr("data-tip",wpc.condition_descriptions[t.condition]||"")}),$(".tips, .help_tip, .woocommerce-help-tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),$("#tiptip_holder").removeAttr("style"),$("#tiptip_arrow").removeAttr("style")}),$(".wpc-conditions-post-table.wpc-sortable-post-table tbody").sortable({items:"tr",handle:".sort",cursor:"move",axis:"y",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(t,o){o.item.css("background-color","#f6f6f6")},stop:function(t,o){o.item.removeAttr("style")},update:function(t,o){$table=$(this).closest("table"),$table.block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var e={action:"wpc_save_post_order",form:$(this).closest("form").serialize(),nonce:wpc.nonce};$.post(ajaxurl,e,function(t){$(".wpc-conditions-post-table tbody tr:even").addClass("alternate"),$(".wpc-conditions-post-table tbody tr:odd").removeClass("alternate"),$table.unblock()})}})});
libraries/wp-conditions/conditions/wpc-contains-product-condition.php CHANGED
@@ -53,11 +53,10 @@ if ( ! class_exists( 'WPC_Contains_Product_Condition' ) ) {
53
 
54
  }
55
 
56
- // @todo
57
  public function get_value_field_args() {
58
 
59
  $field_args = array(
60
- 'type' => 'text',
61
  'custom_attributes' => array(
62
  'data-placeholder' => __( 'Search for a product', 'wp-conditions' ),
63
  ),
@@ -65,10 +64,6 @@ if ( ! class_exists( 'WPC_Contains_Product_Condition' ) ) {
65
  'options' => array(),
66
  );
67
 
68
- if ( version_compare( WC()->version, '2.7', '>=' ) ) {
69
- $field_args['type'] = 'select';
70
- }
71
-
72
  return $field_args;
73
 
74
  }
53
 
54
  }
55
 
 
56
  public function get_value_field_args() {
57
 
58
  $field_args = array(
59
+ 'type' => 'select',
60
  'custom_attributes' => array(
61
  'data-placeholder' => __( 'Search for a product', 'wp-conditions' ),
62
  ),
64
  'options' => array(),
65
  );
66
 
 
 
 
 
67
  return $field_args;
68
 
69
  }
libraries/wp-conditions/conditions/wpc-country-condition.php CHANGED
@@ -34,7 +34,7 @@ if ( ! class_exists( 'WPC_Country_Condition' ) ) {
34
  $match = stripos( $customer_country, $value ) === false;
35
 
36
  // Check for continents if available
37
- if ( ! $match && isset( $customer_continent ) && strpos( $value, 'CO_' ) === 0 ) :
38
  $match = stripos( $customer_continent, str_replace( 'CO_','', $value ) ) === false;
39
  endif;
40
  endif;
34
  $match = stripos( $customer_country, $value ) === false;
35
 
36
  // Check for continents if available
37
+ if ( isset( $customer_continent ) && strpos( $value, 'CO_' ) === 0 ) :
38
  $match = stripos( $customer_continent, str_replace( 'CO_','', $value ) ) === false;
39
  endif;
40
  endif;
libraries/wp-conditions/conditions/wpc-product-category-condition.php CHANGED
@@ -50,6 +50,19 @@ if ( ! class_exists( 'WPC_Product_Category_Condition' ) ) {
50
 
51
  }
52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
  }
54
 
55
  }
50
 
51
  }
52
 
53
+ public function get_value_field_args() {
54
+
55
+ $categories = get_terms( 'product_cat', array( 'hide_empty' => false ) );
56
+ $field_args = array(
57
+ 'type' => 'select',
58
+ 'class' => array( 'wpc-value', 'wc-enhanced-select' ),
59
+ 'options' => wp_list_pluck( $categories, 'name', 'slug' ),
60
+ );
61
+
62
+ return $field_args;
63
+
64
+ }
65
+
66
  }
67
 
68
  }
libraries/wp-conditions/conditions/wpc-product-stock-status-condition.php CHANGED
@@ -19,15 +19,16 @@ if ( ! class_exists( 'WPC_Product_Stock_Status_Condition' ) ) {
19
  }
20
 
21
  public function get_value( $value ) {
22
- $value = ( $value == 'instock' ) ? 1 : $value;
23
- $value = ( $value == 'outofstock' ) ? 0 : $value;
24
  return $value;
25
  }
26
 
27
  public function get_compare_value() {
28
  /** @var $product WC_Product */
29
  global $product;
30
- return $product->is_in_stock();
 
31
  }
32
 
33
  public function get_available_operators() {
@@ -48,6 +49,7 @@ if ( ! class_exists( 'WPC_Product_Stock_Status_Condition' ) ) {
48
  'options' => array(
49
  '1' => __( 'In stock', 'woocommerce' ),
50
  '0' => __( 'Out of stock', 'woocommerce' ),
 
51
  ),
52
  );
53
 
19
  }
20
 
21
  public function get_value( $value ) {
22
+ $value = ( $value == '1' ) ? 'instock' : $value;
23
+ $value = ( $value == '0' ) ? 'outofstock' : $value;
24
  return $value;
25
  }
26
 
27
  public function get_compare_value() {
28
  /** @var $product WC_Product */
29
  global $product;
30
+
31
+ return $product->get_stock_status();
32
  }
33
 
34
  public function get_available_operators() {
49
  'options' => array(
50
  '1' => __( 'In stock', 'woocommerce' ),
51
  '0' => __( 'Out of stock', 'woocommerce' ),
52
+ 'onbackorder' => __( 'On backorder', 'woocommerce' ),
53
  ),
54
  );
55
 
libraries/wp-conditions/conditions/wpc-shipping-method-condition.php CHANGED
@@ -30,7 +30,20 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
30
  }
31
 
32
  public function get_compare_value() {
33
- return (array) WC()->session->get( 'chosen_shipping_methods' );
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
 
36
  public function get_available_operators() {
@@ -56,11 +69,12 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
56
  }
57
 
58
  private function get_shipping_options() {
59
-
60
  $shipping_options = array();
61
- foreach ( WC()->shipping()->load_shipping_methods() as $method ) :
62
- $shipping_options['Methods'][ $method->id ] = $method->get_method_title();
63
- endforeach;
 
 
64
 
65
  // Advanced Shipping
66
  $shipping_options = array_merge( $shipping_options, $this->get_advanced_shipping_rates() );
@@ -69,7 +83,6 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
69
  $shipping_options = array_merge( $shipping_options, $this->get_zone_instances() );
70
 
71
  return $shipping_options;
72
-
73
  }
74
 
75
 
@@ -78,23 +91,21 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
78
  *
79
  * Get the rates from the Advanced Shipping plugin (if available).
80
  *
81
- * @link https://codecanyon.net/item/woocommerce-advanced-shipping/8634573
82
  *
83
  * @return array List of shipping rates.
84
  */
85
  private function get_advanced_shipping_rates() {
86
-
87
  $rates = array();
88
 
89
  $was_rates = new WP_Query( array( 'fields' => 'ids', 'post_type' => 'was', 'post_status' => 'any', 'posts_per_page' => 1000, 'update_post_term_cache' => false, 'no_found_rows' => true ) );
90
- $was_rates = $was_rates->get_posts();
91
- foreach ( $was_rates as $was_id ) :
92
  $shipping_method = get_post_meta( $was_id, '_was_shipping_method', true );
93
  $rates['Advanced Shipping'][ $was_id ] = isset( $shipping_method['shipping_title'] ) ? $shipping_method['shipping_title'] : 'WooCommerce Advanced Shipping rate ID ' . $was_id;
94
- endforeach;
95
 
96
  return $rates;
97
-
98
  }
99
 
100
 
@@ -113,8 +124,9 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
113
  return $rates;
114
  }
115
 
116
- foreach ( WC_Shipping_Zones::get_zones() as $zone ) {
117
  foreach ( $zone['shipping_methods'] as $instance_id => $rate ) {
 
118
  $rates[ $zone['zone_name'] ][ $rate->get_rate_id() ] = $rate->get_title();
119
  }
120
  }
@@ -129,6 +141,31 @@ if ( ! class_exists( 'WPC_Shipping_Method_Condition' ) ) {
129
 
130
  }
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
 
134
  }
30
  }
31
 
32
  public function get_compare_value() {
33
+ $packages_rates = wp_list_pluck( WC()->shipping()->get_packages(), 'rates' );
34
+ $chosen_rate_ids = (array) WC()->session->get( 'chosen_shipping_methods' );
35
+
36
+ // Add shipping method IDs
37
+ foreach ( $packages_rates as $package_key => $rates ) {
38
+ foreach ( $rates as $rate ) {
39
+ if ( array_intersect( array( $rate->id, $rate->method_id, $rate->instance_id ), $chosen_rate_ids ) ) {
40
+ $chosen_rate_ids[] = $rate->method_id;
41
+ $chosen_rate_ids[] = $rate->instance_id;
42
+ }
43
+ }
44
+ }
45
+
46
+ return $chosen_rate_ids;
47
  }
48
 
49
  public function get_available_operators() {
69
  }
70
 
71
  private function get_shipping_options() {
 
72
  $shipping_options = array();
73
+
74
+ // Global shipping methods
75
+ foreach ( WC()->shipping()->load_shipping_methods() as $method ) {
76
+ $shipping_options['Methods (Any zone)'][ $method->id ] = $method->get_method_title();
77
+ }
78
 
79
  // Advanced Shipping
80
  $shipping_options = array_merge( $shipping_options, $this->get_advanced_shipping_rates() );
83
  $shipping_options = array_merge( $shipping_options, $this->get_zone_instances() );
84
 
85
  return $shipping_options;
 
86
  }
87
 
88
 
91
  *
92
  * Get the rates from the Advanced Shipping plugin (if available).
93
  *
94
+ * @link https://aceplugins.com/plugin/advanced-shipping-for-woocommerce/
95
  *
96
  * @return array List of shipping rates.
97
  */
98
  private function get_advanced_shipping_rates() {
 
99
  $rates = array();
100
 
101
  $was_rates = new WP_Query( array( 'fields' => 'ids', 'post_type' => 'was', 'post_status' => 'any', 'posts_per_page' => 1000, 'update_post_term_cache' => false, 'no_found_rows' => true ) );
102
+ $was_rates = $was_rates->posts;
103
+ foreach ( $was_rates as $was_id ) {
104
  $shipping_method = get_post_meta( $was_id, '_was_shipping_method', true );
105
  $rates['Advanced Shipping'][ $was_id ] = isset( $shipping_method['shipping_title'] ) ? $shipping_method['shipping_title'] : 'WooCommerce Advanced Shipping rate ID ' . $was_id;
106
+ }
107
 
108
  return $rates;
 
109
  }
110
 
111
 
124
  return $rates;
125
  }
126
 
127
+ foreach ( $this->get_zones() as $zone ) {
128
  foreach ( $zone['shipping_methods'] as $instance_id => $rate ) {
129
+ /** @var WC_Shipping_Method $rate */
130
  $rates[ $zone['zone_name'] ][ $rate->get_rate_id() ] = $rate->get_title();
131
  }
132
  }
141
 
142
  }
143
 
144
+ /**
145
+ * Get WC Shipping Zones.
146
+ *
147
+ * Get the registered Shipping Zones.
148
+ *
149
+ * @since 1.0.8
150
+ *
151
+ * @return array List of shipping zones.
152
+ */
153
+ private function get_zones() {
154
+ $data_store = WC_Data_Store::load( 'shipping-zone' );
155
+ $raw_zones = $data_store->get_zones();
156
+ $zones = array();
157
+
158
+ foreach ( $raw_zones as $raw_zone ) {
159
+ $zone = new WC_Shipping_Zone( $raw_zone );
160
+ $zones[ $zone->get_id() ] = $zone->get_data();
161
+ $zones[ $zone->get_id() ]['zone_id'] = $zone->get_id();
162
+ $zones[ $zone->get_id() ]['formatted_zone_location'] = $zone->get_formatted_location();
163
+ $zones[ $zone->get_id() ]['shipping_methods'] = $zone->get_shipping_methods( false, 'admin' );
164
+ }
165
+
166
+ return $zones;
167
+ }
168
+
169
  }
170
 
171
  }
libraries/wp-conditions/conditions/wpc-stock-condition.php CHANGED
@@ -28,7 +28,7 @@ if ( ! class_exists( 'WPC_Stock_Condition' ) ) {
28
  endforeach;
29
 
30
  // Get lowest value
31
- return min( $stock );
32
 
33
  }
34
 
28
  endforeach;
29
 
30
  // Get lowest value
31
+ return empty( $stock ) ? null : min( $stock );
32
 
33
  }
34
 
libraries/wp-conditions/conditions/wpc-stock-status-condition.php CHANGED
@@ -24,16 +24,7 @@ if ( ! class_exists( 'WPC_Stock_Status_Condition' ) ) {
24
  // $package['contents']
25
  foreach ( WC()->cart->get_cart() as $item ) :
26
 
27
- /** @var $product WC_Product */
28
- $product = $item['data'];
29
-
30
- if ( method_exists( $product, 'get_stock_status' ) ) { // WC 2.7 compatibility
31
- $stock_status = $product->get_stock_status();
32
- } else { // Pre 2.7
33
- $stock_status = $product->stock_status;
34
- }
35
-
36
- if ( $stock_status != $value ) :
37
  return false;
38
  endif;
39
 
@@ -45,16 +36,7 @@ if ( ! class_exists( 'WPC_Stock_Status_Condition' ) ) {
45
  // $package['contents']
46
  foreach ( WC()->cart->get_cart() as $item ) :
47
 
48
- /** @var $product WC_Product */
49
- $product = $item['data'];
50
-
51
- if ( method_exists( $product, 'get_stock_status' ) ) { // WC 2.7 compatibility
52
- $stock_status = $product->get_stock_status();
53
- } else { // Pre 2.7
54
- $stock_status = $product->stock_status;
55
- }
56
-
57
- if ( $stock_status == $value ) :
58
  return false;
59
  endif;
60
 
@@ -84,6 +66,7 @@ if ( ! class_exists( 'WPC_Stock_Status_Condition' ) ) {
84
  'options' => array(
85
  '1' => __( 'In stock', 'woocommerce' ),
86
  '0' => __( 'Out of stock', 'woocommerce' ),
 
87
  ),
88
  );
89
 
24
  // $package['contents']
25
  foreach ( WC()->cart->get_cart() as $item ) :
26
 
27
+ if ( $item['data']->get_stock_status() != $value ) :
 
 
 
 
 
 
 
 
 
28
  return false;
29
  endif;
30
 
36
  // $package['contents']
37
  foreach ( WC()->cart->get_cart() as $item ) :
38
 
39
+ if ( $item['data']->get_stock_status() == $value ) :
 
 
 
 
 
 
 
 
 
40
  return false;
41
  endif;
42
 
66
  'options' => array(
67
  '1' => __( 'In stock', 'woocommerce' ),
68
  '0' => __( 'Out of stock', 'woocommerce' ),
69
+ 'onbackorder' => __( 'On backorder', 'woocommerce' ),
70
  ),
71
  );
72
 
libraries/wp-conditions/readme.txt CHANGED
@@ -4,10 +4,28 @@ It is intended to be used on plugins like build by Jeroen such as Advanced Shipp
4
  Copyright © 2017 Jeroen Sormani
5
 
6
 
7
- # Current version: 1.0.5
8
 
9
  # Changelog
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  = 1.0.5 - 26/09/2017 =
12
 
13
  - [Improvement] - WC 3.2 changes to prevent notices
4
  Copyright © 2017 Jeroen Sormani
5
 
6
 
7
+ # Current version: 1.0.8
8
 
9
  # Changelog
10
 
11
+ = 1.0.8 - 20/08/2018 =
12
+
13
+ * [Improvement] - Stock status condition now includes 'On backorder'
14
+ * [Improvement] - Remove old WC 2.X backwards compatibility code
15
+ * [Improvement] - 'Shipping method' condition matches on rate ID, method ID or instance ID.
16
+ * [Improvement] - Clean up the CSS styles.
17
+ * [Fix] - 'Country' condition not working with 'not equal to' when using a continent.
18
+
19
+ = 1.0.7 - 14/06/2018 =
20
+
21
+ * [Improvement] - Product Category condition now uses enhanced search field
22
+ * [Fix] - Prevent notice for stock condition when cart is empty
23
+
24
+ = 1.0.6 - 29/01/2018 =
25
+
26
+ * [Fix] - New condition on new condition group gets the wrong condition ID assigned
27
+ * [Improvement] - Accept array in value dropdown with selected() function
28
+
29
  = 1.0.5 - 26/09/2017 =
30
 
31
  - [Improvement] - WC 3.2 changes to prevent notices
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: sormano
3
  Tags: woocommerce shipping, woocommerce, shipping, woocommerce free shipping, woocommerce free, woocommerce advanced free shipping, wc free shipping, wc shipping, advanced shipping, pro shipping, table rate shipping, country shipping, free shipping
4
  Requires at least: 4.0
5
- Tested up to: 4.9
6
- Stable tag: 1.1.3
7
  Requires PHP: 5.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
@@ -59,7 +59,7 @@ Not there what you're looking for? The plugin has been made to be easily extensi
59
  There are a few plugins out there that add a message when someone hasn't reached the free shipping threshold yet. These plugin work on the 'Free shipping' option that is provided in WooCommerce by default.
60
  It is unlikely that these plugins will work out of the box with Advanced Free Shipping due to the complexity of the conditional logic.
61
 
62
- In case you do want to show this kind of message, The [Advanced Messages for WooCommerce](https://shopplugins.com/plugins/woocommerce-advanced-messages/ ) plugin allows you to setup a message with the same type of conditions, allowing you to setup the messages according to the same needs as the free shipping options.
63
 
64
  **Translations, feature requests and ratings are welcome and appreciated!**
65
 
@@ -101,6 +101,12 @@ In the future this will likely be changed, for now I recommend taking a look at
101
 
102
  == Changelog ==
103
 
 
 
 
 
 
 
104
  = 1.1.3 - 26-09-2017 =
105
 
106
  * [Add] - Helpful resources meta box
@@ -216,4 +222,4 @@ In the future this will likely be changed, for now I recommend taking a look at
216
  * [Add] - Added states as condition
217
 
218
  = 1.0.0 =
219
- * Initial release
2
  Contributors: sormano
3
  Tags: woocommerce shipping, woocommerce, shipping, woocommerce free shipping, woocommerce free, woocommerce advanced free shipping, wc free shipping, wc shipping, advanced shipping, pro shipping, table rate shipping, country shipping, free shipping
4
  Requires at least: 4.0
5
+ Tested up to: 5.1
6
+ Stable tag: 1.1.4
7
  Requires PHP: 5.3
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
59
  There are a few plugins out there that add a message when someone hasn't reached the free shipping threshold yet. These plugin work on the 'Free shipping' option that is provided in WooCommerce by default.
60
  It is unlikely that these plugins will work out of the box with Advanced Free Shipping due to the complexity of the conditional logic.
61
 
62
+ In case you do want to show this kind of message, The [Advanced Messages for WooCommerce](https://aceplugins.com/plugin/woocommerce-advanced-messages/) plugin allows you to setup a message with the same type of conditions, allowing you to setup the messages according to the same needs as the free shipping options.
63
 
64
  **Translations, feature requests and ratings are welcome and appreciated!**
65
 
101
 
102
  == Changelog ==
103
 
104
+ = 1.1.4 - 10-04-2018 =
105
+
106
+ * [Improvement] - Improved mobile admin view
107
+ * [Improvement] - Update WP Conditions to 1.0.8
108
+ * [Fix] - Error message on debug mode when creating a new shipping rate
109
+
110
  = 1.1.3 - 26-09-2017 =
111
 
112
  * [Add] - Helpful resources meta box
222
  * [Add] - Added states as condition
223
 
224
  = 1.0.0 =
225
+ * Initial release
woocommerce-advanced-free-shipping.php CHANGED
@@ -3,12 +3,12 @@
3
  * Plugin Name: WooCommerce Advanced Free Shipping
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-advanced-free-shipping/
5
  * Description: WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
6
- * Version: 1.1.3
7
  * Author: Jeroen Sormani
8
- * Author URI: http://jeroensormani.com/
9
  * Text Domain: woocommerce-advanced-free-shipping
10
  * WC requires at least: 3.0.0
11
- * WC tested up to: 3.2.0
12
 
13
  * Copyright Jeroen Sormani
14
  *
@@ -50,7 +50,7 @@ class WooCommerce_Advanced_Free_Shipping {
50
  * @since 1.0.4
51
  * @var string $version Plugin version number.
52
  */
53
- public $version = '1.1.3';
54
 
55
 
56
  /**
@@ -226,10 +226,7 @@ class WooCommerce_Advanced_Free_Shipping {
226
  * @since 1.1.0
227
  */
228
  public function load_textdomain() {
229
-
230
- // Load textdomain
231
  load_plugin_textdomain( 'woocommerce-advanced-free-shipping', false, basename( dirname( __FILE__ ) ) . '/languages' );
232
-
233
  }
234
 
235
 
3
  * Plugin Name: WooCommerce Advanced Free Shipping
4
  * Plugin URI: https://wordpress.org/plugins/woocommerce-advanced-free-shipping/
5
  * Description: WooCommerce Advanced Free Shipping is an plugin which allows you to set up advanced free shipping conditions.
6
+ * Version: 1.1.4
7
  * Author: Jeroen Sormani
8
+ * Author URI: https://jeroensormani.com/
9
  * Text Domain: woocommerce-advanced-free-shipping
10
  * WC requires at least: 3.0.0
11
+ * WC tested up to: 3.5.0
12
 
13
  * Copyright Jeroen Sormani
14
  *
50
  * @since 1.0.4
51
  * @var string $version Plugin version number.
52
  */
53
+ public $version = '1.1.4';
54
 
55
 
56
  /**
226
  * @since 1.1.0
227
  */
228
  public function load_textdomain() {
 
 
229
  load_plugin_textdomain( 'woocommerce-advanced-free-shipping', false, basename( dirname( __FILE__ ) ) . '/languages' );
 
230
  }
231
 
232