WordPress.org

Plugin Directory

Changeset 1687786


Ignore:
Timestamp:
06/29/17 14:01:19 (6 months ago)
Author:
sormano
Message:

ASVWC 1.1.2

Location:
advanced-shipping-validation-for-woocommerce
Files:
4 added
1 deleted
15 edited
59 copied

Legend:

Unmodified
Added
Removed
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/advanced-shipping-validation-for-woocommerce.php

    r1618883 r1687786  
    11<?php 
    22/** 
    3  * Plugin Name:     WooCommerce Advanced Shipping Validation 
     3 * Plugin Name:     Advanced Shipping Validation for WooCommerce 
    44 * Plugin URI:      http://jeroensormani.com/ 
    55 * Description:     Setup shipping validation rules based on your own conditions. Show customers a specific message why they can't continue to checkout. 
    6  * Version:         1.1.1 
     6 * Version:         1.1.2 
    77 * Author:          Jeroen Sormani 
    88 * Author URI:      http://jeroensormani.com/ 
     
    3030     * @var string $version Plugin version number. 
    3131     */ 
    32     public $version = '1.1.1'; 
     32    public $version = '1.1.2'; 
    3333 
    3434 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/assets/admin/css/woocommerce-advanced-shipping-validation.css

    r1607412 r1687786  
    1 .wpc-conditions .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-conditions .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-conditions .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px );height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-conditions .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-conditions .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-conditions .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-conditions .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-conditions>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-conditions .or-text{margin:1.5em 0}.wpc-conditions .match-text{margin:0 0 1em}.wpc-conditions .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-conditions .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-conditions .wpc-condition-wrap.loading{height:30px}.wpc-conditions .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"}.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-shipping_validation .misc-pub-visibility#visibility{display:none}.wcasv-option label{display:inline-block;width:150px}.wcasv-option input{line-height:19px;width:190px}.wcasv_settings_meta_box .wcasv-description{float:none;line-height:19px}.wcasv_settings_meta_box #validation-message{max-width:75%;width:75%;vertical-align:top}.wcasv_conditions_meta_box>p:first-child+div>.or-match{display:none} 
     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-shipping_validation .misc-pub-visibility#visibility{display:none}.wcasv-option label{display:inline-block;width:150px}.wcasv-option input{line-height:19px;width:190px}.wcasv_settings_meta_box .wcasv-description{float:none;line-height:19px}.wcasv_settings_meta_box #validation-message{max-width:75%;width:75%;vertical-align:top}.wcasv_conditions_meta_box>p:first-child+div>.or-match{display:none} 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/includes/admin/views/html-meta-box-conditions.php

    r1607412 r1687786  
    66 
    77?><div class='wpc-conditions wpc-conditions-meta-box'> 
     8    <div class='wpc-condition-groups'> 
    89 
    9     <p> 
    10         <strong><?php _e( 'Match one of the condition groups to display the validation rule:', 'woocommerce-advanced-shipping-validation' ); ?></strong> 
    11     </p><?php 
     10        <p> 
     11            <strong><?php _e( 'Match one of the condition groups to display the validation rule:', 'woocommerce-advanced-shipping-validation' ); ?></strong> 
     12        </p><?php 
    1213 
    13     if ( ! empty( $condition_groups ) ) : 
     14        if ( ! empty( $condition_groups ) ) : 
    1415 
    15         foreach ( $condition_groups as $condition_group => $conditions ) : 
     16            foreach ( $condition_groups as $condition_group => $conditions ) : 
     17                include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
     18            endforeach; 
     19 
     20        else : 
     21 
     22            $condition_group = '0'; 
    1623            include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
    17         endforeach; 
    1824 
    19     else : 
     25        endif; 
    2026 
    21         $condition_group = '0'; 
     27    ?></div> 
     28 
     29    <div class='wpc-condition-group-template hidden' style='display: none'><?php 
     30        $condition_group = '9999'; 
     31        $conditions      = array(); 
    2232        include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
    23  
    24     endif; 
    25  
    26 ?></div> 
    27  
    28 <div class='wpc-condition-group-template hidden' style='display: none'><?php 
    29     $condition_group = '9999'; 
    30     $conditions      = array(); 
    31     include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
    32 ?></div> 
    33 <a class='button wpc-condition-group-add' href='javascript:void(0);'><?php _e( 'Add \'Or\' group', 'woocommerce-advanced-shipping-validation' ); ?></a> 
     33    ?></div> 
     34    <a class='button wpc-condition-group-add' href='javascript:void(0);'><?php _e( 'Add \'Or\' group', 'woocommerce-advanced-shipping-validation' ); ?></a> 
     35</div> 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/includes/class-wcasv-match-conditions.php

    r1618883 r1687786  
    117117    public function match_condition_quantity( $match, $operator, $value, $package, $package_index ) { 
    118118 
    119         if ( ! isset( WC()->cart ) ) : 
    120             return $match; 
    121         endif; 
    122  
    123119        $quantity = 0; 
    124120        foreach ( $package['contents'] as $item_key => $item ) : 
     
    157153    public function match_condition_contains_product( $match, $operator, $value, $package, $package_index ) { 
    158154 
    159         if ( ! isset( WC()->cart ) ) : 
    160             return $match; 
    161         endif; 
    162  
    163155        $product_ids = array(); 
    164156        foreach ( $package['contents'] as $product ) : 
     
    192184     */ 
    193185    public function match_condition_weight( $match, $operator, $value, $package, $package_index ) { 
    194  
    195         if ( ! isset( WC()->cart ) ) : 
    196             return $match; 
    197         endif; 
    198186 
    199187        $weight = 0; 
     
    237225     */ 
    238226    public function match_condition_contains_shipping_class( $match, $operator, $value, $package, $package_index ) { 
    239  
    240         if ( ! isset( WC()->cart ) ) : 
    241             return $match; 
    242         endif; 
    243227 
    244228        if ( $operator == '!=' ) : 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/includes/wcasv-validation-functions.php

    r1618883 r1687786  
    9696    endif; 
    9797 
     98    $context = 'asvwc'; 
    9899    $validation_rules = wcasv_get_validation_posts( array( 'fields' => 'ids' ) ); 
    99100    if ( $packages = WC()->shipping->get_packages() ) : 
     
    102103 
    103104                $condition_groups = get_post_meta( $post_id, '_conditions', true ); 
    104                 if ( wpc_match_conditions( $condition_groups, compact( 'package', 'package_index' ) ) ) : 
     105                if ( wpc_match_conditions( $condition_groups, compact( 'package', 'package_index', 'context' ) ) ) : 
    105106                    $message = get_post_meta( $post_id, '_message', true ); 
    106107                    wc_add_notice( $message, 'error' ); 
     
    130131 */ 
    131132function wcasv_add_bc_filter_condition_match( $match, $condition, $operator, $value, $args = array() ) { 
     133 
     134    if ( ! isset( $args['context'] ) || $args['context'] != 'asvwc' ) { 
     135        return $match; 
     136    } 
    132137 
    133138    if ( has_filter( 'woocommerce_advanced_shipping_validation_match_condition_' . $condition ) ) { 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/assets/css/wp-conditions.min.css

    r1607412 r1687786  
    1 .wpc-conditions .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-conditions .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-conditions .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px );height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-conditions .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-conditions .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-conditions .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-conditions .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-conditions>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-conditions .or-text{margin:1.5em 0}.wpc-conditions .match-text{margin:0 0 1em}.wpc-conditions .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-conditions .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-conditions .wpc-condition-wrap.loading{height:30px}.wpc-conditions .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-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"}.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 .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}} 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/assets/css/wp-conditions.scss

    r1618883 r1687786  
    66 * Conditions 
    77 *************************************************************/ 
    8 .wpc-conditions { 
     8.wpc-condition-groups { 
    99 
    1010    // Condition group 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/assets/js/wp-conditions.js

    r1618883 r1687786  
    33    function wpc_condition_group_repeater() { 
    44        // Condition group repeater 
    5         $( '.wpc-conditions' ).parents( '.postbox' ).repeater({ 
     5        $( '.wpc-conditions' ).repeater({ 
    66            addTrigger: '.wpc-condition-group-add', 
    77            removeTrigger: '.wpc-condition-group .delete', 
    88            template: '.wpc-condition-group-template .wpc-condition-group-wrap', 
    99            elementWrap: '.wpc-condition-group-wrap', 
    10             elementsContainer: '.wpc-conditions', 
     10            elementsContainer: '.wpc-condition-groups', 
    1111            removeElement: function( el ) { 
    1212                el.remove(); 
     
    3232    // Assign new ID to repeater row + open collapsible + re-enable nested repeater 
    3333    jQuery( document.body ).on( 'repeater-added-row', function( e, template, container, $self ) { 
    34         var new_id = Math.floor(Math.random()*8999999999+1000000000); // Random number sequence of 10 length 
     34        var new_id = Math.floor(Math.random()*899999999+100000000); // Random number sequence of 9 length 
    3535        template.find( 'input[name], select[name]' ).attr( 'name', function( index, value ) { 
    3636            return ( value.replace( '9999', new_id ) ) || value; 
     
    5454        var condition_group_wrap = $( this ).parents( '.wpc-condition-group-wrap' ), 
    5555            condition_group_id   = condition_group_wrap.find( '.wpc-condition-group' ).attr( 'data-group' ), 
    56             condition_group_list = $( this ).parents( '.wpc-conditions' ), 
     56            condition_group_list = $( this ).parents( '.wpc-condition-groups' ), 
    5757            new_group            = condition_group_wrap.clone(), 
    58             new_group_id         = Math.floor(Math.random()*8999999999+1000000000); // Random number sequence of 10 length 
     58            new_group_id         = Math.floor(Math.random()*899999999+100000000); // Random number sequence of 9 length 
    5959 
    6060        // Fix dropdown selected not being cloned properly 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/assets/js/wp-conditions.min.js

    r1618883 r1687786  
    1 jQuery(function($){function t(){$(".wpc-conditions").parents(".postbox").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-conditions",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(8999999999*Math.random()+1e9);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-conditions"),i=t.clone(),a=Math.floor(8999999999*Math.random()+1e9);$(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()})}})}); 
     1jQuery(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()})}})}); 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/conditions/wpc-contains-product-condition.php

    r1618883 r1687786  
    3232 
    3333            $product_ids = array(); 
    34             foreach ( WC()->cart->get_cart() as $product ) : 
    35                 $product_ids[] = $product['product_id']; 
    36                 if ( isset( $product['variation_id'] ) ) { 
    37                     $product_ids[] = $product['variation_id']; 
     34            foreach ( WC()->cart->get_cart() as $item ) : 
     35                $product_ids[] = $item['product_id']; 
     36                if ( isset( $item['variation_id'] ) ) { 
     37                    $product_ids[] = $item['variation_id']; 
    3838                } 
    3939            endforeach; 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/conditions/wpc-role-condition.php

    r1618883 r1687786  
    3535                return $current_user->caps; 
    3636            } else { 
    37                 return array( 'not_logged_in' ); 
     37                return array( 'not_logged_in' => 'not_logged_in' ); 
    3838            } 
    3939 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/conditions/wpc-zipcode-condition.php

    r1618883 r1687786  
    1010            $this->slug        = __( 'zipcode', 'wpc-conditions' ); 
    1111            $this->group       = __( 'User', 'wpc-conditions' ); 
    12             $this->description = __( 'Compare against customer zipcode. Comma separated list allowed. Use \'*\' for wildcard', 'wpc-conditions' ); 
     12            $this->description = __( 'Compare against customer zipcode. All zipcodes are matched with a \'starts with\' matching method.', 'wpc-conditions' ); 
    1313 
    1414            parent::__construct(); 
     
    2424 
    2525                foreach ( $value_zipcodes as $zip ) : 
    26                     if ( $match = preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
     26                    $parts = explode( '-', $zip ); 
     27                    if ( count( $parts ) > 1 && $match = ( $zipcode >= min( $parts ) && $zipcode <= max( $parts ) ) ) : 
     28                        break; 
     29                    elseif ( $match = preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
    2730                        break; 
    2831                    endif; 
     
    3336                $match = true; 
    3437                foreach ( $value_zipcodes as $zip ) : 
    35                     if ( preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
     38                    $parts = explode( '-', $zip ); 
     39                    if ( count( $parts ) > 1 && ( $zipcode >= min( $parts ) && $zipcode <= max( $parts ) ) ) : 
    3640                        return $match = false; 
    37                         break; 
     41                    elseif ( preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
     42                        return $match = false; 
    3843                    endif; 
    3944                endforeach; 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/libraries/wp-conditions/functions.php

    r1618883 r1687786  
    4040require_once 'conditions/wpc-stock-condition.php'; 
    4141require_once 'conditions/wpc-category-condition.php'; 
     42require_once 'conditions/wpc-volume-condition.php'; 
    4243 
    4344// Product (single based) 
     
    9697            new WPC_Stock_Condition(), 
    9798            new WPC_Category_Condition(), 
     99            new WPC_Volume_Condition(), 
    98100 
    99101            new WPC_Product_Condition(), 
  • advanced-shipping-validation-for-woocommerce/tags/1.1.2/readme.txt

    r1618883 r1687786  
    33Tags: woocommerce woocommerce, shipping, woocommerce shipping validation, woocommerce shipping validation rules, shipping rules, prevent shipping, block shipping, prohibit shipping, forbid shipping, avoid shipping, restrict shipping, stop shipping 
    44Requires at least: 4.0 
    5 Tested up to: 4.7.2 
    6 Stable tag: 1.1.1 
     5Tested up to: 4.8 
     6Stable tag: 1.1.2 
    77License: GPLv3 or later 
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    3636 
    3737== Changelog == 
     38 
     39= 1.1.2 - 29-06-2017 = 
     40 
     41* [Improvement] - Update WP Conditions to 1.0.3 
     42        - [Fix] - 'User role' condition 'Guest' wasn't working 
     43        - [Improvement] - Allow conditions outside postbox / multiple times inside. Not limited to .postbox class. 
     44        - [Add] - Zipcode range support. E.g. 'Zipcode' = 'equal to' = '10000-20000,30000-40000' 
    3845 
    3946= 1.1.1 - 21-03-2017 = 
  • advanced-shipping-validation-for-woocommerce/trunk/advanced-shipping-validation-for-woocommerce.php

    r1618883 r1687786  
    11<?php 
    22/** 
    3  * Plugin Name:     WooCommerce Advanced Shipping Validation 
     3 * Plugin Name:     Advanced Shipping Validation for WooCommerce 
    44 * Plugin URI:      http://jeroensormani.com/ 
    55 * Description:     Setup shipping validation rules based on your own conditions. Show customers a specific message why they can't continue to checkout. 
    6  * Version:         1.1.1 
     6 * Version:         1.1.2 
    77 * Author:          Jeroen Sormani 
    88 * Author URI:      http://jeroensormani.com/ 
     
    3030     * @var string $version Plugin version number. 
    3131     */ 
    32     public $version = '1.1.1'; 
     32    public $version = '1.1.2'; 
    3333 
    3434 
  • advanced-shipping-validation-for-woocommerce/trunk/assets/admin/css/woocommerce-advanced-shipping-validation.css

    r1607412 r1687786  
    1 .wpc-conditions .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-conditions .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-conditions .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px );height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-conditions .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-conditions .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-conditions .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-conditions .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-conditions>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-conditions .or-text{margin:1.5em 0}.wpc-conditions .match-text{margin:0 0 1em}.wpc-conditions .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-conditions .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-conditions .wpc-condition-wrap.loading{height:30px}.wpc-conditions .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"}.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-shipping_validation .misc-pub-visibility#visibility{display:none}.wcasv-option label{display:inline-block;width:150px}.wcasv-option input{line-height:19px;width:190px}.wcasv_settings_meta_box .wcasv-description{float:none;line-height:19px}.wcasv_settings_meta_box #validation-message{max-width:75%;width:75%;vertical-align:top}.wcasv_conditions_meta_box>p:first-child+div>.or-match{display:none} 
     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-shipping_validation .misc-pub-visibility#visibility{display:none}.wcasv-option label{display:inline-block;width:150px}.wcasv-option input{line-height:19px;width:190px}.wcasv_settings_meta_box .wcasv-description{float:none;line-height:19px}.wcasv_settings_meta_box #validation-message{max-width:75%;width:75%;vertical-align:top}.wcasv_conditions_meta_box>p:first-child+div>.or-match{display:none} 
  • advanced-shipping-validation-for-woocommerce/trunk/includes/admin/views/html-meta-box-conditions.php

    r1607412 r1687786  
    66 
    77?><div class='wpc-conditions wpc-conditions-meta-box'> 
     8    <div class='wpc-condition-groups'> 
    89 
    9     <p> 
    10         <strong><?php _e( 'Match one of the condition groups to display the validation rule:', 'woocommerce-advanced-shipping-validation' ); ?></strong> 
    11     </p><?php 
     10        <p> 
     11            <strong><?php _e( 'Match one of the condition groups to display the validation rule:', 'woocommerce-advanced-shipping-validation' ); ?></strong> 
     12        </p><?php 
    1213 
    13     if ( ! empty( $condition_groups ) ) : 
     14        if ( ! empty( $condition_groups ) ) : 
    1415 
    15         foreach ( $condition_groups as $condition_group => $conditions ) : 
     16            foreach ( $condition_groups as $condition_group => $conditions ) : 
     17                include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
     18            endforeach; 
     19 
     20        else : 
     21 
     22            $condition_group = '0'; 
    1623            include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
    17         endforeach; 
    1824 
    19     else : 
     25        endif; 
    2026 
    21         $condition_group = '0'; 
     27    ?></div> 
     28 
     29    <div class='wpc-condition-group-template hidden' style='display: none'><?php 
     30        $condition_group = '9999'; 
     31        $conditions      = array(); 
    2232        include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
    23  
    24     endif; 
    25  
    26 ?></div> 
    27  
    28 <div class='wpc-condition-group-template hidden' style='display: none'><?php 
    29     $condition_group = '9999'; 
    30     $conditions      = array(); 
    31     include plugin_dir_path( __FILE__ ) . 'html-condition-group.php'; 
    32 ?></div> 
    33 <a class='button wpc-condition-group-add' href='javascript:void(0);'><?php _e( 'Add \'Or\' group', 'woocommerce-advanced-shipping-validation' ); ?></a> 
     33    ?></div> 
     34    <a class='button wpc-condition-group-add' href='javascript:void(0);'><?php _e( 'Add \'Or\' group', 'woocommerce-advanced-shipping-validation' ); ?></a> 
     35</div> 
  • advanced-shipping-validation-for-woocommerce/trunk/includes/class-wcasv-match-conditions.php

    r1618883 r1687786  
    117117    public function match_condition_quantity( $match, $operator, $value, $package, $package_index ) { 
    118118 
    119         if ( ! isset( WC()->cart ) ) : 
    120             return $match; 
    121         endif; 
    122  
    123119        $quantity = 0; 
    124120        foreach ( $package['contents'] as $item_key => $item ) : 
     
    157153    public function match_condition_contains_product( $match, $operator, $value, $package, $package_index ) { 
    158154 
    159         if ( ! isset( WC()->cart ) ) : 
    160             return $match; 
    161         endif; 
    162  
    163155        $product_ids = array(); 
    164156        foreach ( $package['contents'] as $product ) : 
     
    192184     */ 
    193185    public function match_condition_weight( $match, $operator, $value, $package, $package_index ) { 
    194  
    195         if ( ! isset( WC()->cart ) ) : 
    196             return $match; 
    197         endif; 
    198186 
    199187        $weight = 0; 
     
    237225     */ 
    238226    public function match_condition_contains_shipping_class( $match, $operator, $value, $package, $package_index ) { 
    239  
    240         if ( ! isset( WC()->cart ) ) : 
    241             return $match; 
    242         endif; 
    243227 
    244228        if ( $operator == '!=' ) : 
  • advanced-shipping-validation-for-woocommerce/trunk/includes/wcasv-validation-functions.php

    r1618883 r1687786  
    9696    endif; 
    9797 
     98    $context = 'asvwc'; 
    9899    $validation_rules = wcasv_get_validation_posts( array( 'fields' => 'ids' ) ); 
    99100    if ( $packages = WC()->shipping->get_packages() ) : 
     
    102103 
    103104                $condition_groups = get_post_meta( $post_id, '_conditions', true ); 
    104                 if ( wpc_match_conditions( $condition_groups, compact( 'package', 'package_index' ) ) ) : 
     105                if ( wpc_match_conditions( $condition_groups, compact( 'package', 'package_index', 'context' ) ) ) : 
    105106                    $message = get_post_meta( $post_id, '_message', true ); 
    106107                    wc_add_notice( $message, 'error' ); 
     
    130131 */ 
    131132function wcasv_add_bc_filter_condition_match( $match, $condition, $operator, $value, $args = array() ) { 
     133 
     134    if ( ! isset( $args['context'] ) || $args['context'] != 'asvwc' ) { 
     135        return $match; 
     136    } 
    132137 
    133138    if ( has_filter( 'woocommerce_advanced_shipping_validation_match_condition_' . $condition ) ) { 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/assets/css/wp-conditions.min.css

    r1607412 r1687786  
    1 .wpc-conditions .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-conditions .wpc-condition-group:hover .wpc-condition-group-actions{opacity:1}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions{opacity:0;margin:-10px -10px 0 0;font-size:80%}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a{text-decoration:none}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete{color:#a00}.wpc-conditions .wpc-condition-group .wpc-condition-group-actions a.delete:hover{color:#f00}.wpc-conditions .wpc-condition-group .wpc-condition-wrap{margin:10px 0 5px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-condition{width:35%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-operator{width:22.5%}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-value{width:calc( 42.5% - 75px );height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description{float:right}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip{height:28px;line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap .wpc-description .woocommerce-help-tip:after{line-height:28px}.wpc-conditions .wpc-condition-group .wpc-condition-wrap input{vertical-align:top}.wpc-conditions .clearfix:after{content:" ";display:block;height:0;clear:both}.wpc-conditions .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-conditions .wpc-condition-delete.button{font-weight:600;width:30px;text-align:center;padding:0}.wpc-conditions .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-conditions>p+.wpc-condition-group-wrap p.or-text{display:none}.wpc-conditions .or-text{margin:1.5em 0}.wpc-conditions .match-text{margin:0 0 1em}.wpc-conditions .wpc-condition-delete{display:none;opacity:0;transition:opacity .3s ease-in-out}.wpc-conditions .wpc-condition-wrap:hover .wpc-condition-delete{display:inline-block;opacity:1}.wpc-conditions .wpc-condition-wrap.loading{height:30px}.wpc-conditions .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-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"}.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 .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}} 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/assets/css/wp-conditions.scss

    r1618883 r1687786  
    66 * Conditions 
    77 *************************************************************/ 
    8 .wpc-conditions { 
     8.wpc-condition-groups { 
    99 
    1010    // Condition group 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/assets/js/wp-conditions.js

    r1618883 r1687786  
    33    function wpc_condition_group_repeater() { 
    44        // Condition group repeater 
    5         $( '.wpc-conditions' ).parents( '.postbox' ).repeater({ 
     5        $( '.wpc-conditions' ).repeater({ 
    66            addTrigger: '.wpc-condition-group-add', 
    77            removeTrigger: '.wpc-condition-group .delete', 
    88            template: '.wpc-condition-group-template .wpc-condition-group-wrap', 
    99            elementWrap: '.wpc-condition-group-wrap', 
    10             elementsContainer: '.wpc-conditions', 
     10            elementsContainer: '.wpc-condition-groups', 
    1111            removeElement: function( el ) { 
    1212                el.remove(); 
     
    3232    // Assign new ID to repeater row + open collapsible + re-enable nested repeater 
    3333    jQuery( document.body ).on( 'repeater-added-row', function( e, template, container, $self ) { 
    34         var new_id = Math.floor(Math.random()*8999999999+1000000000); // Random number sequence of 10 length 
     34        var new_id = Math.floor(Math.random()*899999999+100000000); // Random number sequence of 9 length 
    3535        template.find( 'input[name], select[name]' ).attr( 'name', function( index, value ) { 
    3636            return ( value.replace( '9999', new_id ) ) || value; 
     
    5454        var condition_group_wrap = $( this ).parents( '.wpc-condition-group-wrap' ), 
    5555            condition_group_id   = condition_group_wrap.find( '.wpc-condition-group' ).attr( 'data-group' ), 
    56             condition_group_list = $( this ).parents( '.wpc-conditions' ), 
     56            condition_group_list = $( this ).parents( '.wpc-condition-groups' ), 
    5757            new_group            = condition_group_wrap.clone(), 
    58             new_group_id         = Math.floor(Math.random()*8999999999+1000000000); // Random number sequence of 10 length 
     58            new_group_id         = Math.floor(Math.random()*899999999+100000000); // Random number sequence of 9 length 
    5959 
    6060        // Fix dropdown selected not being cloned properly 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/assets/js/wp-conditions.min.js

    r1618883 r1687786  
    1 jQuery(function($){function t(){$(".wpc-conditions").parents(".postbox").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-conditions",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(8999999999*Math.random()+1e9);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-conditions"),i=t.clone(),a=Math.floor(8999999999*Math.random()+1e9);$(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()})}})}); 
     1jQuery(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()})}})}); 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/conditions/wpc-contains-product-condition.php

    r1618883 r1687786  
    3232 
    3333            $product_ids = array(); 
    34             foreach ( WC()->cart->get_cart() as $product ) : 
    35                 $product_ids[] = $product['product_id']; 
    36                 if ( isset( $product['variation_id'] ) ) { 
    37                     $product_ids[] = $product['variation_id']; 
     34            foreach ( WC()->cart->get_cart() as $item ) : 
     35                $product_ids[] = $item['product_id']; 
     36                if ( isset( $item['variation_id'] ) ) { 
     37                    $product_ids[] = $item['variation_id']; 
    3838                } 
    3939            endforeach; 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/conditions/wpc-role-condition.php

    r1618883 r1687786  
    3535                return $current_user->caps; 
    3636            } else { 
    37                 return array( 'not_logged_in' ); 
     37                return array( 'not_logged_in' => 'not_logged_in' ); 
    3838            } 
    3939 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/conditions/wpc-zipcode-condition.php

    r1618883 r1687786  
    1010            $this->slug        = __( 'zipcode', 'wpc-conditions' ); 
    1111            $this->group       = __( 'User', 'wpc-conditions' ); 
    12             $this->description = __( 'Compare against customer zipcode. Comma separated list allowed. Use \'*\' for wildcard', 'wpc-conditions' ); 
     12            $this->description = __( 'Compare against customer zipcode. All zipcodes are matched with a \'starts with\' matching method.', 'wpc-conditions' ); 
    1313 
    1414            parent::__construct(); 
     
    2424 
    2525                foreach ( $value_zipcodes as $zip ) : 
    26                     if ( $match = preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
     26                    $parts = explode( '-', $zip ); 
     27                    if ( count( $parts ) > 1 && $match = ( $zipcode >= min( $parts ) && $zipcode <= max( $parts ) ) ) : 
     28                        break; 
     29                    elseif ( $match = preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
    2730                        break; 
    2831                    endif; 
     
    3336                $match = true; 
    3437                foreach ( $value_zipcodes as $zip ) : 
    35                     if ( preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
     38                    $parts = explode( '-', $zip ); 
     39                    if ( count( $parts ) > 1 && ( $zipcode >= min( $parts ) && $zipcode <= max( $parts ) ) ) : 
    3640                        return $match = false; 
    37                         break; 
     41                    elseif ( preg_match( '/^' . preg_quote( $zip, '/' ) . '/i', $zipcode ) ) : 
     42                        return $match = false; 
    3843                    endif; 
    3944                endforeach; 
  • advanced-shipping-validation-for-woocommerce/trunk/libraries/wp-conditions/functions.php

    r1618883 r1687786  
    4040require_once 'conditions/wpc-stock-condition.php'; 
    4141require_once 'conditions/wpc-category-condition.php'; 
     42require_once 'conditions/wpc-volume-condition.php'; 
    4243 
    4344// Product (single based) 
     
    9697            new WPC_Stock_Condition(), 
    9798            new WPC_Category_Condition(), 
     99            new WPC_Volume_Condition(), 
    98100 
    99101            new WPC_Product_Condition(), 
  • advanced-shipping-validation-for-woocommerce/trunk/readme.txt

    r1618883 r1687786  
    33Tags: woocommerce woocommerce, shipping, woocommerce shipping validation, woocommerce shipping validation rules, shipping rules, prevent shipping, block shipping, prohibit shipping, forbid shipping, avoid shipping, restrict shipping, stop shipping 
    44Requires at least: 4.0 
    5 Tested up to: 4.7.2 
    6 Stable tag: 1.1.1 
     5Tested up to: 4.8 
     6Stable tag: 1.1.2 
    77License: GPLv3 or later 
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html 
     
    3636 
    3737== Changelog == 
     38 
     39= 1.1.2 - 29-06-2017 = 
     40 
     41* [Improvement] - Update WP Conditions to 1.0.3 
     42        - [Fix] - 'User role' condition 'Guest' wasn't working 
     43        - [Improvement] - Allow conditions outside postbox / multiple times inside. Not limited to .postbox class. 
     44        - [Add] - Zipcode range support. E.g. 'Zipcode' = 'equal to' = '10000-20000,30000-40000' 
    3845 
    3946= 1.1.1 - 21-03-2017 = 
Note: See TracChangeset for help on using the changeset viewer.