using spaces after text
This commit is contained in:
parent
d6f8ef13d0
commit
f9fafc7d16
|
@ -70,10 +70,11 @@ class WC_Shipping_Local_Delivery extends WC_Shipping_Method {
|
|||
foreach ( WC()->cart->get_cart() as $item_id => $values ) {
|
||||
$_product = $values['data'];
|
||||
|
||||
if ( $values['quantity'] > 0 && $_product->needs_shipping() )
|
||||
if ( $values['quantity'] > 0 && $_product->needs_shipping() ) {
|
||||
$shipping_total += $this->fee * $values['quantity'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$rate = array(
|
||||
'id' => $this->id,
|
||||
|
@ -196,18 +197,18 @@ class WC_Shipping_Local_Delivery extends WC_Shipping_Method {
|
|||
|
||||
$found_match = false;
|
||||
|
||||
if ( in_array( $this->clean( $package['destination']['postcode'] ), $codes ) )
|
||||
if ( in_array( $this->clean( $package['destination']['postcode'] ), $codes ) ) {
|
||||
$found_match = true;
|
||||
}
|
||||
|
||||
|
||||
// Pattern match
|
||||
if ( ! $found_match ) {
|
||||
|
||||
$customer_postcode = $this->clean( $package['destination']['postcode'] );
|
||||
|
||||
foreach ($codes as $c) {
|
||||
$pattern = '/^'.str_replace('_', '[0-9a-zA-Z]', $c).'$/i';
|
||||
if(preg_match($pattern, $customer_postcode)) {
|
||||
$pattern = '/^' . str_replace( '_', '[0-9a-zA-Z]', $c ) . '$/i';
|
||||
if ( preg_match( $pattern, $customer_postcode ) ) {
|
||||
$found_match = true;
|
||||
break;
|
||||
}
|
||||
|
@ -224,26 +225,31 @@ class WC_Shipping_Local_Delivery extends WC_Shipping_Method {
|
|||
|
||||
for ( $i = 0; $i <= $customer_postcode_length; $i++ ) {
|
||||
|
||||
if ( in_array( $customer_postcode, $codes ) )
|
||||
if ( in_array( $customer_postcode, $codes ) ) {
|
||||
$found_match = true;
|
||||
}
|
||||
|
||||
$customer_postcode = substr( $customer_postcode, 0, -2 ) . '*';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $found_match )
|
||||
if ( ! $found_match ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Either post codes not setup, or post codes are in array... so lefts check countries for backwards compatibility.
|
||||
if ( $this->availability == 'specific' )
|
||||
if ( $this->availability == 'specific' ) {
|
||||
$ship_to_countries = $this->countries;
|
||||
else
|
||||
} else {
|
||||
$ship_to_countries = array_keys( WC()->countries->get_shipping_countries() );
|
||||
}
|
||||
|
||||
if (is_array($ship_to_countries))
|
||||
if (!in_array( $package['destination']['country'] , $ship_to_countries))
|
||||
if (is_array($ship_to_countries)) {
|
||||
if (!in_array( $package['destination']['country'] , $ship_to_countries)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Yay! We passed!
|
||||
return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', true );
|
||||
|
|
Loading…
Reference in New Issue