Merge branch 'master' into fix/20311

This commit is contained in:
Mike Jolley 2018-06-05 12:57:48 +01:00
commit 001a2e3b98
20 changed files with 191 additions and 94 deletions

View File

@ -85,7 +85,7 @@
} }
}); });
$( '.submit input' ).click( function() { $( '.submit :input' ).click( function() {
window.onbeforeunload = ''; window.onbeforeunload = '';
}); });
}); });

View File

@ -565,10 +565,19 @@
$product_link = $product_img_wrap.find( 'a' ).eq( 0 ); $product_link = $product_img_wrap.find( 'a' ).eq( 0 );
if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) { if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) {
$form.wc_variations_image_reset(); // See if the gallery has an image with the same original src as the image we want to switch to.
var galleryHasImage = $gallery_nav.find( 'li img[data-o_src="' + variation.image.gallery_thumbnail_src + '"]' ).length > 0;
if ( $gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' ).length > 0 ) { // If the gallery has the image, reset the images. We'll scroll to the correct one.
$gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' ).trigger( 'click' ); if ( galleryHasImage ) {
$form.wc_variations_image_reset();
}
// See if gallery has a matching image we can slide to.
var slideToImage = $gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' );
if ( slideToImage.length > 0 ) {
slideToImage.trigger( 'click' );
$form.attr( 'current-image', variation.image_id ); $form.attr( 'current-image', variation.image_id );
return; return;
} else { } else {

View File

@ -29,7 +29,7 @@
strength = wc_password_strength_meter.checkPasswordStrength( wrapper, field ); strength = wc_password_strength_meter.checkPasswordStrength( wrapper, field );
if ( fieldValue.length > 0 && strength < wc_password_strength_meter_params.min_password_strength && ! wrapper.is( 'form.checkout' ) ) { if ( fieldValue.length > 0 && strength < wc_password_strength_meter_params.min_password_strength && ! wrapper.is( 'form.checkout' ) && -1 !== strength ) {
submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' ); submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
} else { } else {
submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' ); submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' );

177
composer.lock generated
View File

@ -936,25 +936,28 @@
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.7.0", "version": "1.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/478465659fd987669df0bd8a9bf22a8710e5f1b6",
"reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", "reference": "478465659fd987669df0bd8a9bf22a8710e5f1b6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.6 || ^7.0" "php": "^7.1"
},
"replace": {
"myclabs/deep-copy": "self.version"
}, },
"require-dev": { "require-dev": {
"doctrine/collections": "^1.0", "doctrine/collections": "^1.0",
"doctrine/common": "^2.6", "doctrine/common": "^2.6",
"phpunit/phpunit": "^4.1" "phpunit/phpunit": "^7.1"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -977,7 +980,7 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2017-10-19T19:58:43+00:00" "time": "2018-05-29T17:25:09+00:00"
}, },
{ {
"name": "nette/application", "name": "nette/application",
@ -2064,23 +2067,23 @@
}, },
{ {
"name": "phpspec/prophecy", "name": "phpspec/prophecy",
"version": "1.7.5", "version": "1.7.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpspec/prophecy.git", "url": "https://github.com/phpspec/prophecy.git",
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401" "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/dfd6be44111a7c41c2e884a336cc4f461b3b2401", "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
"reference": "dfd6be44111a7c41c2e884a336cc4f461b3b2401", "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"doctrine/instantiator": "^1.0.2", "doctrine/instantiator": "^1.0.2",
"php": "^5.3|^7.0", "php": "^5.3|^7.0",
"phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0",
"sebastian/comparator": "^1.1|^2.0", "sebastian/comparator": "^1.1|^2.0|^3.0",
"sebastian/recursion-context": "^1.0|^2.0|^3.0" "sebastian/recursion-context": "^1.0|^2.0|^3.0"
}, },
"require-dev": { "require-dev": {
@ -2123,20 +2126,20 @@
"spy", "spy",
"stub" "stub"
], ],
"time": "2018-02-19T10:16:54+00:00" "time": "2018-04-18T13:57:24+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "5.3.0", "version": "5.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" "reference": "c89677919c5dd6d3b3852f230a663118762218ac"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c89677919c5dd6d3b3852f230a663118762218ac",
"reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", "reference": "c89677919c5dd6d3b3852f230a663118762218ac",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2186,7 +2189,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2017-12-06T09:29:45+00:00" "time": "2018-04-06T15:36:58+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@ -2376,16 +2379,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "6.5.7", "version": "6.5.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9" "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6bd77b57707c236833d2b57b968e403df060c9d9", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
"reference": "6bd77b57707c236833d2b57b968e403df060c9d9", "reference": "4f21a3c6b97c42952fd5c2837bb354ec0199b97b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2456,20 +2459,20 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2018-02-26T07:01:09+00:00" "time": "2018-04-10T11:38:34+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
"version": "5.0.6", "version": "5.0.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
"reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf" "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/33fd41a76e746b8fa96d00b49a23dadfa8334cdf", "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3eaf040f20154d27d6da59ca2c6e28ac8fd56dce",
"reference": "33fd41a76e746b8fa96d00b49a23dadfa8334cdf", "reference": "3eaf040f20154d27d6da59ca2c6e28ac8fd56dce",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2515,7 +2518,7 @@
"mock", "mock",
"xunit" "xunit"
], ],
"time": "2018-01-06T05:45:45+00:00" "time": "2018-05-29T13:50:43+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
@ -3225,16 +3228,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v2.8.35", "version": "v2.8.41",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27" "reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a6ff8b2ffa4eb43046828b303af2e3fedadacc27", "url": "https://api.github.com/repos/symfony/console/zipball/e8e59b74ad1274714dad2748349b55e3e6e630c7",
"reference": "a6ff8b2ffa4eb43046828b303af2e3fedadacc27", "reference": "e8e59b74ad1274714dad2748349b55e3e6e630c7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3248,7 +3251,7 @@
"symfony/process": "~2.1|~3.0.0" "symfony/process": "~2.1|~3.0.0"
}, },
"suggest": { "suggest": {
"psr/log": "For using the console logger", "psr/log-implementation": "For using the console logger",
"symfony/event-dispatcher": "", "symfony/event-dispatcher": "",
"symfony/process": "" "symfony/process": ""
}, },
@ -3282,7 +3285,7 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-02-26T15:33:21+00:00" "time": "2018-05-15T21:17:45+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
@ -3397,17 +3400,72 @@
"time": "2015-05-13T11:33:56+00:00" "time": "2015-05-13T11:33:56+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-ctype",
"version": "v1.7.0", "version": "v1.8.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.8-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2018-04-30T19:57:29+00:00"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.8.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "3296adf6a6454a050679cde90f95350ad604b171"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171",
"reference": "3296adf6a6454a050679cde90f95350ad604b171",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3419,7 +3477,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.7-dev" "dev-master": "1.8-dev"
} }
}, },
"autoload": { "autoload": {
@ -3453,24 +3511,25 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2018-01-30T19:27:44+00:00" "time": "2018-04-26T10:06:28+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v2.8.35", "version": "v2.8.41",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "be720fcfae4614df204190d57795351059946a77" "reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/be720fcfae4614df204190d57795351059946a77", "url": "https://api.github.com/repos/symfony/yaml/zipball/51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff",
"reference": "be720fcfae4614df204190d57795351059946a77", "reference": "51356b7a2ff7c9fd06b2f1681cc463bb62b5c1ff",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.9" "php": ">=5.3.9",
"symfony/polyfill-ctype": "~1.8"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -3502,7 +3561,7 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2018-01-03T07:36:31+00:00" "time": "2018-05-01T22:52:40+00:00"
}, },
{ {
"name": "theseer/tokenizer", "name": "theseer/tokenizer",
@ -3546,16 +3605,16 @@
}, },
{ {
"name": "tracy/tracy", "name": "tracy/tracy",
"version": "v2.4.12", "version": "v2.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nette/tracy.git", "url": "https://github.com/nette/tracy.git",
"reference": "4182ce7b92f67002509b7fa2fc34bd84deea0b24" "reference": "534d4e4f0f31da494026a3761fad020c20b8debf"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nette/tracy/zipball/4182ce7b92f67002509b7fa2fc34bd84deea0b24", "url": "https://api.github.com/repos/nette/tracy/zipball/534d4e4f0f31da494026a3761fad020c20b8debf",
"reference": "4182ce7b92f67002509b7fa2fc34bd84deea0b24", "reference": "534d4e4f0f31da494026a3761fad020c20b8debf",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3573,7 +3632,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.4-dev" "dev-master": "2.5-dev"
} }
}, },
"autoload": { "autoload": {
@ -3607,7 +3666,7 @@
"nette", "nette",
"profiler" "profiler"
], ],
"time": "2018-02-28T00:49:47+00:00" "time": "2018-05-25T09:33:08+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",
@ -3746,16 +3805,16 @@
}, },
{ {
"name": "woocommerce/woocommerce-sniffs", "name": "woocommerce/woocommerce-sniffs",
"version": "0.0.1", "version": "0.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/woocommerce/woocommerce-sniffs.git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git",
"reference": "383d5b361c1d7532ae1ca6156fd7619fd37bbc05" "reference": "2890fd5d98b318f62acb42f2b5cd6d02627cfd82"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/383d5b361c1d7532ae1ca6156fd7619fd37bbc05", "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/2890fd5d98b318f62acb42f2b5cd6d02627cfd82",
"reference": "383d5b361c1d7532ae1ca6156fd7619fd37bbc05", "reference": "2890fd5d98b318f62acb42f2b5cd6d02627cfd82",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3783,7 +3842,7 @@
"woocommerce", "woocommerce",
"wordpress" "wordpress"
], ],
"time": "2017-12-21T22:52:52+00:00" "time": "2018-03-22T18:39:19+00:00"
}, },
{ {
"name": "wp-coding-standards/wpcs", "name": "wp-coding-standards/wpcs",

View File

@ -1324,7 +1324,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
$shipping_tax_class = count( $found_classes ) ? current( $found_classes ) : false; $shipping_tax_class = count( $found_classes ) ? current( $found_classes ) : false;
} }
$is_vat_exempt = apply_filters( 'woocommerce_order_is_vat_exempt', 'yes' === $this->get_meta( 'is_vat_exempt' ) ); $is_vat_exempt = apply_filters( 'woocommerce_order_is_vat_exempt', 'yes' === $this->get_meta( 'is_vat_exempt' ), $this );
// Trigger tax recalculation for all items. // Trigger tax recalculation for all items.
foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) { foreach ( $this->get_items( array( 'line_item', 'fee' ) ) as $item_id => $item ) {

View File

@ -293,6 +293,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
wc_product_dropdown_categories( wc_product_dropdown_categories(
array( array(
'option_select_text' => __( 'Filter by category', 'woocommerce' ), 'option_select_text' => __( 'Filter by category', 'woocommerce' ),
'hide_empty' => 0,
) )
); );
} else { } else {

View File

@ -99,6 +99,9 @@ if ( ! defined( 'ABSPATH' ) ) {
</tr> </tr>
</tbody> </tbody>
</table> </table>
<?php do_action( 'woocommerce_shipping_zone_after_methods_table' ); ?>
<p class="submit"> <p class="submit">
<button type="submit" name="submit" id="submit" class="button button-primary button-large wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button> <button type="submit" name="submit" id="submit" class="button button-primary button-large wc-shipping-zone-method-save" value="<?php esc_attr_e( 'Save changes', 'woocommerce' ); ?>" disabled><?php esc_html_e( 'Save changes', 'woocommerce' ); ?></button>
</p> </p>

View File

@ -222,7 +222,7 @@ class WC_Cache_Helper {
if ( 'product_cat' === $taxonomy ) { if ( 'product_cat' === $taxonomy ) {
$ids = is_array( $ids ) ? $ids : array( $ids ); $ids = is_array( $ids ) ? $ids : array( $ids );
$clear_ids = array(); $clear_ids = array( 0 );
foreach ( $ids as $id ) { foreach ( $ids as $id ) {
$clear_ids[] = $id; $clear_ids[] = $id;

View File

@ -1452,12 +1452,13 @@ class WC_Cart extends WC_Legacy_Cart {
// Get user and posted emails to compare. // Get user and posted emails to compare.
$current_user = wp_get_current_user(); $current_user = wp_get_current_user();
$billing_email = isset( $posted['billing_email'] ) ? $posted['billing_email'] : '';
$check_emails = array_unique( $check_emails = array_unique(
array_filter( array_filter(
array_map( array_map(
'strtolower', array_map( 'strtolower', array_map(
'sanitize_email', array( 'sanitize_email', array(
$posted['billing_email'], $billing_email,
$current_user->user_email, $current_user->user_email,
) )
) )

View File

@ -673,8 +673,16 @@ class WC_Checkout {
$data[ $key ] = wc_format_postcode( $data[ $key ], $country ); $data[ $key ] = wc_format_postcode( $data[ $key ], $country );
if ( '' !== $data[ $key ] && ! WC_Validation::is_postcode( $data[ $key ], $country ) ) { if ( '' !== $data[ $key ] && ! WC_Validation::is_postcode( $data[ $key ], $country ) ) {
switch ( $country ) {
case 'IE':
/* translators: %1$s: field name, %2$s finder.eircode.ie URL */
$postcode_validation_notice = sprintf( __( '%1$s is not a valid. You can look up the correct Eircode <a target="_blank" href="%2$s">here</a>.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>', 'https://finder.eircode.ie' );
break;
default:
/* translators: %s: field name */ /* translators: %s: field name */
$errors->add( 'validation', sprintf( __( '%s is not a valid postcode / ZIP.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>' ) ); $postcode_validation_notice = sprintf( __( '%s is not a valid postcode / ZIP.', 'woocommerce' ), '<strong>' . esc_html( $field_label ) . '</strong>' );
}
$errors->add( 'validation', apply_filters( 'woocommerce_checkout_postcode_validation_notice', $postcode_validation_notice, $country, $data[ $key ] ) );
} }
} }

View File

@ -788,6 +788,11 @@ class WC_Countries {
'label' => __( 'Province', 'woocommerce' ), 'label' => __( 'Province', 'woocommerce' ),
), ),
), ),
'BH' => array(
'state' => array(
'required' => false,
),
),
'BI' => array( 'BI' => array(
'state' => array( 'state' => array(
'required' => false, 'required' => false,

View File

@ -119,6 +119,8 @@ class WC_Data_Store {
/** /**
* Re-run the constructor with the object type. * Re-run the constructor with the object type.
*
* @throws Exception When validation fails.
*/ */
public function __wakeup() { public function __wakeup() {
$this->__construct( $this->object_type ); $this->__construct( $this->object_type );
@ -130,6 +132,7 @@ class WC_Data_Store {
* @param string $object_type Name of object. * @param string $object_type Name of object.
* *
* @since 3.0.0 * @since 3.0.0
* @throws Exception When validation fails.
* @return WC_Data_Store * @return WC_Data_Store
*/ */
public static function load( $object_type ) { public static function load( $object_type ) {

View File

@ -45,11 +45,7 @@ class WC_DateTime extends DateTime {
* Get UTC offset if set, or default to the DateTime object's offset. * Get UTC offset if set, or default to the DateTime object's offset.
*/ */
public function getOffset() { public function getOffset() {
if ( $this->utc_offset ) { return $this->utc_offset ? $this->utc_offset : parent::getOffset();
return $this->utc_offset;
} else {
return parent::getOffset();
}
} }
/** /**

View File

@ -161,8 +161,16 @@ class WC_Emails {
self::instance(); // Init self so emails exist. self::instance(); // Init self so emails exist.
do_action_ref_array( current_filter() . '_notification', $args ); do_action_ref_array( current_filter() . '_notification', $args );
} catch ( Exception $e ) { } catch ( Exception $e ) {
$error = 'Transactional email triggered fatal error for callback ' . current_filter();
$logger = wc_get_logger();
$logger->critical(
$error . PHP_EOL,
array(
'source' => 'transactional-emails',
)
);
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
trigger_error( 'Transactional email triggered fatal error for callback ' . current_filter(), E_USER_WARNING ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped, WordPress.PHP.DevelopmentFunctions.error_log_trigger_error trigger_error( $error, E_USER_WARNING ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped, WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
} }
} }
} }

View File

@ -179,19 +179,14 @@ class WC_Payment_Gateways {
return; return;
} }
if ( is_user_logged_in() ) { $current_gateway = false;
$default_token = WC_Payment_Tokens::get_customer_default_token( get_current_user_id() ); $current = WC()->session->get( 'chosen_payment_method' );
if ( ! is_null( $default_token ) ) {
$default_token_gateway = $default_token->get_gateway_id();
}
}
$current = ( isset( $default_token_gateway ) ? $default_token_gateway : WC()->session->get( 'chosen_payment_method' ) );
if ( $current && isset( $gateways[ $current ] ) ) { if ( $current && isset( $gateways[ $current ] ) ) {
$current_gateway = $gateways[ $current ]; $current_gateway = $gateways[ $current ];
}
} else { if ( ! $current_gateway ) {
$current_gateway = current( $gateways ); $current_gateway = current( $gateways );
} }

View File

@ -25,13 +25,16 @@ class WC_Privacy_Exporters {
$data_to_export = array(); $data_to_export = array();
if ( $user instanceof WP_User ) { if ( $user instanceof WP_User ) {
$customer_personal_data = self::get_customer_personal_data( $user );
if ( ! empty( $customer_personal_data ) ) {
$data_to_export[] = array( $data_to_export[] = array(
'group_id' => 'woocommerce_customer', 'group_id' => 'woocommerce_customer',
'group_label' => __( 'Customer Data', 'woocommerce' ), 'group_label' => __( 'Customer Data', 'woocommerce' ),
'item_id' => 'user', 'item_id' => 'user',
'data' => self::get_customer_personal_data( $user ), 'data' => $customer_personal_data,
); );
} }
}
return array( return array(
'data' => $data_to_export, 'data' => $data_to_export,

View File

@ -69,6 +69,9 @@ class WC_Validation {
case 'GB': case 'GB':
$valid = self::is_gb_postcode( $postcode ); $valid = self::is_gb_postcode( $postcode );
break; break;
case 'IE':
$valid = (bool) preg_match( '/([AC-FHKNPRTV-Y]\d{2}|D6W)[0-9AC-FHKNPRTV-Y]{4}/', wc_normalize_postcode( $postcode ) );
break;
case 'JP': case 'JP':
$valid = (bool) preg_match( '/^([0-9]{3})([-])([0-9]{4})$/', $postcode ); $valid = (bool) preg_match( '/^([0-9]{3})([-])([0-9]{4})$/', $postcode );
break; break;

View File

@ -280,7 +280,7 @@ function wc_cart_totals_coupon_html( $coupon ) {
$amount = WC()->cart->get_coupon_discount_amount( $coupon->get_code(), WC()->cart->display_cart_ex_tax ); $amount = WC()->cart->get_coupon_discount_amount( $coupon->get_code(), WC()->cart->display_cart_ex_tax );
$discount_amount_html = '-' . wc_price( $amount ); $discount_amount_html = '-' . wc_price( $amount );
if ( $coupon->get_free_shipping() ) { if ( $coupon->get_free_shipping() && empty( $amount ) ) {
$discount_amount_html = __( 'Free shipping coupon', 'woocommerce' ); $discount_amount_html = __( 'Free shipping coupon', 'woocommerce' );
} }

View File

@ -900,6 +900,9 @@ function wc_format_postcode( $postcode, $country ) {
case 'GB': case 'GB':
$postcode = trim( substr_replace( $postcode, ' ', -3, 0 ) ); $postcode = trim( substr_replace( $postcode, ' ', -3, 0 ) );
break; break;
case 'IE':
$postcode = trim( substr_replace( $postcode, ' ', 3, 0 ) );
break;
case 'BR': case 'BR':
case 'PL': case 'PL':
$postcode = substr_replace( $postcode, '-', -3, 0 ); $postcode = substr_replace( $postcode, '-', -3, 0 );

View File

@ -293,7 +293,7 @@ class WC_Widget_Layered_Nav extends WC_Widget {
if ( jQuery().selectWoo ) { if ( jQuery().selectWoo ) {
var wc_layered_nav_select = function() { var wc_layered_nav_select = function() {
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . "' ).selectWoo( { jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . "' ).selectWoo( {
placeholder: '" . esc_html( $any_label ) . "', placeholder: '" . esc_js( $any_label ) . "',
minimumResultsForSearch: 5, minimumResultsForSearch: 5,
width: '100%', width: '100%',
allowClear: " . ( $multiple ? 'false' : 'true' ) . ", allowClear: " . ( $multiple ? 'false' : 'true' ) . ",