Merge branch 'trunk' into fix/30371

This commit is contained in:
Ron Rennick 2021-09-22 11:29:08 -03:00
commit 32e3919604
26 changed files with 853 additions and 91 deletions

View File

@ -182,7 +182,6 @@
}
}
.current-section-dropdown:hover,
.current-section-dropdown.is-open {
ul {
@ -775,6 +774,24 @@
}
}
.no-touch,
.no-js {
.wc-addons-wrap {
.current-section-dropdown:hover {
ul {
display: flex;
}
.current-section-name::after {
transform: rotate(0.5turn);
}
}
}
}
.wc-subscriptions-wrap {
max-width: 1200px;
}

View File

@ -653,7 +653,17 @@ jQuery( function ( $ ) {
},
delete_item: function() {
var answer = window.confirm( woocommerce_admin_meta_boxes.remove_item_notice );
var notice = woocommerce_admin_meta_boxes.remove_item_notice;
if ( $( this ).parents( 'tbody#order_fee_line_items' ).length ) {
notice = woocommerce_admin_meta_boxes.remove_fee_notice;
}
if ( $( this ).parents( 'tbody#order_shipping_line_items' ).length ) {
notice = woocommerce_admin_meta_boxes.remove_shipping_notice;
}
var answer = window.confirm( notice );
if ( answer ) {
var $item = $( this ).closest( 'tr.item, tr.fee, tr.shipping' );

View File

@ -412,17 +412,21 @@
var marketplaceMenuIsOpen = false;
// Add event listener to toggle Marketplace menu on touch devices
if ( marketplaceSectionDropdown.length && isTouchDevice() ) {
marketplaceSectionName.on( 'click', function() {
marketplaceMenuIsOpen = ! marketplaceMenuIsOpen;
if ( marketplaceMenuIsOpen ) {
marketplaceSectionDropdown.addClass( 'is-open' );
$( document ).on( 'click', maybeToggleMarketplaceMenu );
} else {
marketplaceSectionDropdown.removeClass( 'is-open' );
$( document ).off( 'click', maybeToggleMarketplaceMenu );
}
} );
if ( marketplaceSectionDropdown.length ) {
if ( isTouchDevice() ) {
marketplaceSectionName.on( 'click', function() {
marketplaceMenuIsOpen = ! marketplaceMenuIsOpen;
if ( marketplaceMenuIsOpen ) {
marketplaceSectionDropdown.addClass( 'is-open' );
$( document ).on( 'click', maybeToggleMarketplaceMenu );
} else {
marketplaceSectionDropdown.removeClass( 'is-open' );
$( document ).off( 'click', maybeToggleMarketplaceMenu );
}
} );
} else {
document.body.classList.add( 'no-touch' );
}
}
// Close menu if the user clicks outside it

View File

@ -33,6 +33,7 @@
"squizlabs/php_codesniffer": "^3.5",
"vimeo/psalm": "^4.4"
},
"default-branch": true,
"bin": [
"bin/mozart"
],
@ -53,6 +54,10 @@
}
],
"description": "Composes all dependencies as a package inside a WordPress plugin",
"support": {
"issues": "https://github.com/coenjacobs/mozart/issues",
"source": "https://github.com/coenjacobs/mozart/tree/master"
},
"funding": [
{
"url": "https://github.com/coenjacobs",
@ -143,6 +148,10 @@
"sftp",
"storage"
],
"support": {
"issues": "https://github.com/thephpleague/flysystem/issues",
"source": "https://github.com/thephpleague/flysystem/tree/1.1.5"
},
"funding": [
{
"url": "https://offset.earth/frankdejonge",
@ -191,6 +200,10 @@
}
],
"description": "Mime-type detection for Flysystem",
"support": {
"issues": "https://github.com/thephpleague/mime-type-detection/issues",
"source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0"
},
"funding": [
{
"url": "https://github.com/frankdejonge",
@ -245,6 +258,10 @@
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/1.1.1"
},
"time": "2021-03-05T17:36:06+00:00"
},
{
@ -327,6 +344,9 @@
"console",
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.3.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -391,6 +411,9 @@
],
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -450,6 +473,9 @@
],
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v5.3.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -526,6 +552,9 @@
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -604,6 +633,9 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -685,6 +717,9 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -762,6 +797,9 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -838,6 +876,9 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -918,6 +959,9 @@
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -994,6 +1038,9 @@
"interoperability",
"standards"
],
"support": {
"source": "https://github.com/symfony/service-contracts/tree/v2.4.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -1074,6 +1121,9 @@
"utf-8",
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v5.3.7"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -1103,5 +1153,5 @@
"platform-overrides": {
"php": "7.3"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -71,6 +71,10 @@
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues",
"source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer"
},
"time": "2020-12-07T18:04:37+00:00"
},
{
@ -129,6 +133,10 @@
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibility/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibility"
},
"time": "2019-12-27T09:44:58+00:00"
},
{
@ -181,6 +189,10 @@
"polyfill",
"standards"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie"
},
"time": "2021-02-15T10:24:51+00:00"
},
{
@ -231,6 +243,10 @@
"standards",
"wordpress"
],
"support": {
"issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues",
"source": "https://github.com/PHPCompatibility/PHPCompatibilityWP"
},
"time": "2021-07-21T11:09:57+00:00"
},
{
@ -282,6 +298,11 @@
"phpcs",
"standards"
],
"support": {
"issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues",
"source": "https://github.com/squizlabs/PHP_CodeSniffer",
"wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki"
},
"time": "2021-04-09T00:54:41+00:00"
},
{
@ -322,6 +343,10 @@
"woocommerce",
"wordpress"
],
"support": {
"issues": "https://github.com/woocommerce/woocommerce-sniffs/issues",
"source": "https://github.com/woocommerce/woocommerce-sniffs/tree/0.1.1"
},
"time": "2021-07-29T17:25:16+00:00"
},
{
@ -368,6 +393,11 @@
"standards",
"wordpress"
],
"support": {
"issues": "https://github.com/WordPress/WordPress-Coding-Standards/issues",
"source": "https://github.com/WordPress/WordPress-Coding-Standards",
"wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki"
},
"time": "2020-05-13T23:57:56+00:00"
}
],
@ -381,5 +411,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -59,6 +59,10 @@
"constructor",
"instantiate"
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/master"
},
"time": "2015-06-14T21:17:01+00:00"
},
{
@ -104,6 +108,10 @@
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.x"
},
"time": "2017-10-19T19:58:43+00:00"
},
{
@ -159,6 +167,10 @@
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/master"
},
"time": "2017-03-05T18:14:27+00:00"
},
{
@ -206,6 +218,10 @@
}
],
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/master"
},
"time": "2017-03-05T17:38:23+00:00"
},
{
@ -260,6 +276,10 @@
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master"
},
"time": "2017-09-11T18:02:19+00:00"
},
{
@ -312,6 +332,10 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x"
},
"time": "2019-12-28T18:55:12+00:00"
},
{
@ -357,6 +381,10 @@
"email": "me@mikevanriel.com"
}
],
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/master"
},
"time": "2017-12-30T13:23:38+00:00"
},
{
@ -420,6 +448,10 @@
"spy",
"stub"
],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
},
"time": "2020-03-05T15:02:03+00:00"
},
{
@ -483,6 +515,10 @@
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/5.3"
},
"time": "2018-04-06T15:36:58+00:00"
},
{
@ -530,6 +566,11 @@
"filesystem",
"iterator"
],
"support": {
"irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5"
},
"time": "2017-11-27T13:52:08+00:00"
},
{
@ -571,6 +612,10 @@
"keywords": [
"template"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
},
"time": "2015-06-21T13:50:34+00:00"
},
{
@ -620,6 +665,10 @@
"keywords": [
"timer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
"source": "https://github.com/sebastianbergmann/php-timer/tree/master"
},
"time": "2017-02-26T11:10:40+00:00"
},
{
@ -669,6 +718,10 @@
"keywords": [
"tokenizer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
},
"abandoned": true,
"time": "2017-11-27T05:48:46+00:00"
},
@ -754,6 +807,10 @@
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/6.5.14"
},
"time": "2019-02-01T05:22:47+00:00"
},
{
@ -813,6 +870,10 @@
"mock",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
"source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/5.0.10"
},
"abandoned": true,
"time": "2018-08-09T05:50:03+00:00"
},
@ -859,6 +920,10 @@
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -929,6 +994,10 @@
"compare",
"equality"
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/master"
},
"time": "2018-02-01T13:46:46+00:00"
},
{
@ -981,6 +1050,10 @@
"keywords": [
"diff"
],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/master"
},
"time": "2017-08-03T08:09:46+00:00"
},
{
@ -1031,6 +1104,10 @@
"environment",
"hhvm"
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/master"
},
"time": "2017-07-01T08:51:00+00:00"
},
{
@ -1098,6 +1175,10 @@
"export",
"exporter"
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1155,6 +1236,10 @@
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0"
},
"time": "2017-04-27T15:39:26+00:00"
},
{
@ -1202,6 +1287,10 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1253,6 +1342,10 @@
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
"source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1312,6 +1405,10 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1360,6 +1457,10 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"support": {
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
"source": "https://github.com/sebastianbergmann/resource-operations/tree/master"
},
"time": "2015-07-28T20:34:47+00:00"
},
{
@ -1403,6 +1504,10 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"support": {
"issues": "https://github.com/sebastianbergmann/version/issues",
"source": "https://github.com/sebastianbergmann/version/tree/master"
},
"time": "2016-10-03T07:35:21+00:00"
},
{
@ -1465,6 +1570,9 @@
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -1519,6 +1627,10 @@
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master"
},
"time": "2019-06-13T22:48:21+00:00"
},
{
@ -1568,6 +1680,10 @@
"check",
"validate"
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.9.1"
},
"time": "2020-07-08T17:02:28+00:00"
}
],
@ -1581,5 +1697,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -67,6 +67,11 @@
"po",
"translation"
],
"support": {
"email": "oom@oscarotero.com",
"issues": "https://github.com/oscarotero/Gettext/issues",
"source": "https://github.com/php-gettext/Gettext/tree/v4.8.5"
},
"funding": [
{
"url": "https://paypal.me/oscarotero",
@ -141,6 +146,10 @@
"translations",
"unicode"
],
"support": {
"issues": "https://github.com/php-gettext/Languages/issues",
"source": "https://github.com/php-gettext/Languages/tree/2.8.1"
},
"funding": [
{
"url": "https://paypal.me/mlocati",
@ -155,16 +164,16 @@
},
{
"name": "mck89/peast",
"version": "v1.13.6",
"version": "v1.13.8",
"source": {
"type": "git",
"url": "https://github.com/mck89/peast.git",
"reference": "67566e6d594ffb70057fee7adceac9300998cc95"
"reference": "4f0423441ec557f3935b056d10987f2e1c7a3e76"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mck89/peast/zipball/67566e6d594ffb70057fee7adceac9300998cc95",
"reference": "67566e6d594ffb70057fee7adceac9300998cc95",
"url": "https://api.github.com/repos/mck89/peast/zipball/4f0423441ec557f3935b056d10987f2e1c7a3e76",
"reference": "4f0423441ec557f3935b056d10987f2e1c7a3e76",
"shasum": ""
},
"require": {
@ -176,7 +185,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.13.6-dev"
"dev-master": "1.13.8-dev"
}
},
"autoload": {
@ -196,7 +205,11 @@
}
],
"description": "Peast is PHP library that generates AST for JavaScript code",
"time": "2021-08-23T10:30:32+00:00"
"support": {
"issues": "https://github.com/mck89/peast/issues",
"source": "https://github.com/mck89/peast/tree/v1.13.8"
},
"time": "2021-09-11T10:28:18+00:00"
},
{
"name": "mustache/mustache",
@ -242,6 +255,10 @@
"mustache",
"templating"
],
"support": {
"issues": "https://github.com/bobthecow/mustache.php/issues",
"source": "https://github.com/bobthecow/mustache.php/tree/master"
},
"time": "2019-11-23T21:40:31+00:00"
},
{
@ -298,6 +315,10 @@
"iri",
"sockets"
],
"support": {
"issues": "https://github.com/WordPress/Requests/issues",
"source": "https://github.com/WordPress/Requests/tree/v1.8.1"
},
"time": "2021-06-04T09:56:25+00:00"
},
{
@ -347,6 +368,9 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/3.3"
},
"time": "2017-06-01T21:01:25+00:00"
},
{
@ -407,6 +431,10 @@
],
"description": "Provides internationalization tools for WordPress projects.",
"homepage": "https://github.com/wp-cli/i18n-command",
"support": {
"issues": "https://github.com/wp-cli/i18n-command/issues",
"source": "https://github.com/wp-cli/i18n-command/tree/v2.2.9"
},
"time": "2021-07-20T21:25:54+00:00"
},
{
@ -455,6 +483,9 @@
],
"description": "A simple YAML loader/dumper class for PHP (WP-CLI fork)",
"homepage": "https://github.com/mustangostang/spyc/",
"support": {
"source": "https://github.com/wp-cli/spyc/tree/autoload"
},
"time": "2017-04-25T11:26:20+00:00"
},
{
@ -505,6 +536,10 @@
"cli",
"console"
],
"support": {
"issues": "https://github.com/wp-cli/php-cli-tools/issues",
"source": "https://github.com/wp-cli/php-cli-tools/tree/v0.11.13"
},
"time": "2021-07-01T15:08:16+00:00"
},
{
@ -571,6 +606,11 @@
"cli",
"wordpress"
],
"support": {
"docs": "https://make.wordpress.org/cli/handbook/",
"issues": "https://github.com/wp-cli/wp-cli/issues",
"source": "https://github.com/wp-cli/wp-cli"
},
"time": "2021-05-14T13:44:51+00:00"
}
],
@ -584,5 +624,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -1,5 +1,97 @@
== Changelog ==
= 5.7.0 2021-09-21 =
**WooCommerce**
* Fix - WC default pages are being re-created during db migration in some cases. #30540
* Fix - Use type casts to reduce the risk of type errors in some unusual conditions. #30493
* Fix - Restores Select2 4.0.3 for backwards compatibility reasons. #30473
* Fix - product attribute permalinks not working for non-ASCII characters. #30443
* Fix - Variations menu order not applying correctly when manually set in some cases. #30423
* Fix - Users with capabilities such as the admin are not able to the see downloadable file images after uploading. #30385
* Fix - Products quick edit was not showing the correct value for visibility setting. #30374
* Fix - Fixed inability to set payment token as non-default. #30176
* Dev - Add payment method title for the option "Other". #30256
* Dev - Remove tracking of admin user agent. #30514
* Dev - Added a new Tracks event when the user views the My Subscriptions page. #30488
* Dev - Added new woocommerce_product_options_external hook. #30448
* Dev - Update countries with no states to be consistent in codebase. #30435
* Dev - Split the Extensions page in WP Admin and add respective menu items. #30380
* Dev - Set 'WC_Customer::$object_type' to 'customer'. #30325
* Dev - Added new woocommerce_product_options_external hook. #30229
* Enhancement - Add mobile section menu to marketplace. #30499
* Enhancement - Track the state and postcode of the store location. #30483
* Enhancement - Split the "Extensions" page into two pages, "Marketplace" and "My Subscriptions". Apply new design to Marketplace. #30391
* Enhancement - Added new Ukrainian states. #30230
* Enhancement - Update locale-info.php to contain all the countries, currency specs and locale information. #30216
* Tweak - Update product card on mobile devices so that content doesn't overflow. #30498
* Tweak - Change top bar menu to a dropdown menu. #30498
* Tweak - Add top margin above .addons-button in promos, to ensure there's a proper gap above it on smaller viewports. #30497
* Tweak - Slightly change the wording and styling of the Search results for label at the top of extensions search results. #30497
* Tweak - Display notices properly in Marketplace page. #30478
* Tweak - Update the Marketplace page menu styles to match the current design. #30464
* Tweak - Update product cards on the WooCommerce > Extensions page in WP Admin to match current designs. #30410
* Tweak - Update the Marketplace/Addons header to match new designs. #30389
* Tweak - Renamed "ZIP" to "ZIP Code" and "Pin code" to "PIN" for US & India, respectively. #30204
* Tweak - Download filepaths.
**WooCommerce Admin - 2.6.0 & 2.6.1 & 2.6.2 & 2.6.3 & 2.6.4**
- Fix: Fixes action button mis-alignment within card footer. #7412
- Fix: Fixing issues with ReportTable component data not populating correctly #7355
- Fix: Fix tracks events for payment gateway suggestions #7304
- Fix: Update status values in CSV download to match the table #7284
- Fix: Allow super admins all capabilities within WooCommerce Admin #7489
- Fix: Fix blank screen by setting a default value #7506
- Fix: Fix analytics overview re-arrangement on initial load. #7475
- Fix: Fix up onboarding profiler not working when opted out of tracking #7490
- Fix: Fix blank screen on analytics screens when searching #7482
- Fix: Fix all links with hash to behind query parameters #7483
- Fix: Fix Stats module CSS issue introduced by Gutenberg #7488
- Fix: Fix marketing task visibility #7580
- Fix: Fix stats-overview card padding issue #7594
- Fix: Fix layout issue on the marketing task #7598
- Fix: Use installable extensions for local state versus free extensions. #7585
- Fix: Fix unsecured reports
- Fix: Fix fatal error and unrelated results in analytics. #7682
- Fix Update task-item logic to only display content when expanded is true. #7611
- Add: Add boolean isReverseTrend prop to SummaryNumber to show "positive" delta for negative numbers. #7357
- Add: Adding links to help panel for marketing task #7384
- Add: Add installed marketing extensions card to extensions task #7419
- Add: Add marketing extensions task to task list #7383
- Add: Add tracks to marketing manage button click #7467
- Add: Add default marketing extensions as fallbacks #7466
- Add: Add marketing task completion check and tests #7451
- Add navigation items for the Marketplace menu. #7529
- Update: Add locale param as part of free extensions request #7391
- Update: Increase per_page value for search results on the Analytics pages. #7385
- Update: Removing grow section from local free extensions in OBW #7386
- Update: Don't show the marketing task if no marketing tasks exist #7460
- Update: Delete free extensions transient on WCA update #7454
- Update: Update business details to use extensions data store #7452
- Update: Split Extensions page into Marketplace and My Subscriptions. #7471
- Update: Update marketing task completion logic. #7586
- Dev: Added utm_medium=product to woocommerce.com links. #7408
- Dev: Update Jest to version 27. #7430
- Tweak: Refactor on payment settings recommendations eligibility component for reuse. #7447
- Tweak: Register wc-admin page for all users and handle authorization in client #7285
**WooCommerce Blocks - 5.6.0 & 5.7.0 & 5.7.1**
- Enhancement - Featured Category Block: Allow user to re-select categories using the edit icon. #4559
- Enhancement - Update pagination arrows to match core. #4364
- Fix - Adjusted store notice class names so that error notices show the correct icons. #4568
- Fix - Reviews by Category: Show review count instead of product count. #4552
- Fix - Add server side rendering to search block so the block can be used by non-admins. #4551
- Fix - Twenty Twenty: Fix broken sale badge left alignment. #4549
- Fix - Twenty Twenty-One: Adjust removable chip background color. #4547
- Fix - Fix handpicked product selections when a store has over 100 products. #4534
- Fix - Replace .screen-reader-text with .hidden for elements that are not relevant to screen readers. #4530
- Fix - Fixed the SKU search on the /wc/store/products endpoint. #4469
- Fix - Fix memory leak when previewing transform options for the All reviews block. #4428
- Fix - Disable Cart, Checkout, All Products & filters blocks from the widgets screen. #4646
= 5.6.0 2021-08-17 =
**WooCommerce**

View File

@ -20,9 +20,9 @@
"maxmind-db/reader": "1.6.0",
"pelago/emogrifier": "3.1.0",
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.2.1",
"woocommerce/woocommerce-admin": "2.6.1",
"woocommerce/woocommerce-blocks": "5.7.1"
"woocommerce/action-scheduler": "3.3.0",
"woocommerce/woocommerce-admin": "2.7.0-rc.1",
"woocommerce/woocommerce-blocks": "5.9.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",

211
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "564854f0d3f2451ece6a90204c134cd0",
"content-hash": "ab83245c9816437b7120b146014ff686",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -51,6 +51,9 @@
"GPL-2.0-or-later"
],
"description": "Creates a custom autoloader for a plugin or theme.",
"support": {
"source": "https://github.com/Automattic/jetpack-autoloader/tree/2.10.1"
},
"time": "2021-03-30T15:15:59+00:00"
},
{
@ -82,20 +85,23 @@
"GPL-2.0-or-later"
],
"description": "A wrapper for defining constants in a more testable way.",
"support": {
"source": "https://github.com/Automattic/jetpack-constants/tree/v1.5.1"
},
"time": "2020-10-28T19:00:31+00:00"
},
{
"name": "composer/installers",
"version": "v1.11.0",
"version": "v1.12.0",
"source": {
"type": "git",
"url": "https://github.com/composer/installers.git",
"reference": "ae03311f45dfe194412081526be2e003960df74b"
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b",
"reference": "ae03311f45dfe194412081526be2e003960df74b",
"url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19",
"reference": "d20a64ed3c94748397ff5973488761b22f6d3f19",
"shasum": ""
},
"require": {
@ -194,6 +200,7 @@
"modx",
"moodle",
"osclass",
"pantheon",
"phpbb",
"piwik",
"ppi",
@ -214,6 +221,10 @@
"zend",
"zikula"
],
"support": {
"issues": "https://github.com/composer/installers/issues",
"source": "https://github.com/composer/installers/tree/v1.12.0"
},
"funding": [
{
"url": "https://packagist.com",
@ -228,7 +239,7 @@
"type": "tidelift"
}
],
"time": "2021-04-28T06:42:17+00:00"
"time": "2021-09-13T08:19:44+00:00"
},
{
"name": "maxmind-db/reader",
@ -288,6 +299,10 @@
"geolocation",
"maxmind"
],
"support": {
"issues": "https://github.com/maxmind/MaxMind-DB-Reader-php/issues",
"source": "https://github.com/maxmind/MaxMind-DB-Reader-php/tree/v1.6.0"
},
"time": "2019-12-19T22:59:03+00:00"
},
{
@ -362,6 +377,10 @@
"email",
"pre-processing"
],
"support": {
"issues": "https://github.com/MyIntervals/emogrifier/issues",
"source": "https://github.com/MyIntervals/emogrifier"
},
"time": "2019-12-26T19:37:31+00:00"
},
{
@ -411,6 +430,10 @@
"container-interop",
"psr"
],
"support": {
"issues": "https://github.com/php-fig/container/issues",
"source": "https://github.com/php-fig/container/tree/master"
},
"time": "2017-02-14T16:28:37+00:00"
},
{
@ -464,20 +487,23 @@
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/css-selector/tree/master"
},
"time": "2017-05-01T15:01:29+00:00"
},
{
"name": "woocommerce/action-scheduler",
"version": "3.2.1",
"version": "3.3.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/action-scheduler.git",
"reference": "3c24064f115cd55e972d73d5d48f14133ac60b0d"
"reference": "5588a831cd2453ecf7d4803f3a81063e13cde93d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/3c24064f115cd55e972d73d5d48f14133ac60b0d",
"reference": "3c24064f115cd55e972d73d5d48f14133ac60b0d",
"url": "https://api.github.com/repos/woocommerce/action-scheduler/zipball/5588a831cd2453ecf7d4803f3a81063e13cde93d",
"reference": "5588a831cd2453ecf7d4803f3a81063e13cde93d",
"shasum": ""
},
"require-dev": {
@ -499,20 +525,24 @@
],
"description": "Action Scheduler for WordPress and WooCommerce",
"homepage": "https://actionscheduler.org/",
"time": "2021-06-21T20:21:35+00:00"
"support": {
"issues": "https://github.com/woocommerce/action-scheduler/issues",
"source": "https://github.com/woocommerce/action-scheduler/tree/3.3.0"
},
"time": "2021-09-15T21:08:48+00:00"
},
{
"name": "woocommerce/woocommerce-admin",
"version": "2.6.1",
"version": "2.7.0-rc.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "d4cf43f89e6eee136e06ab598b815571f1de59d6"
"reference": "7c5eb86f723353f5a04572414eecdabca77616f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/d4cf43f89e6eee136e06ab598b815571f1de59d6",
"reference": "d4cf43f89e6eee136e06ab598b815571f1de59d6",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/7c5eb86f723353f5a04572414eecdabca77616f6",
"reference": "7c5eb86f723353f5a04572414eecdabca77616f6",
"shasum": ""
},
"require": {
@ -565,20 +595,24 @@
],
"description": "A modern, javascript-driven WooCommerce Admin experience.",
"homepage": "https://github.com/woocommerce/woocommerce-admin",
"time": "2021-09-02T00:33:46+00:00"
"support": {
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v2.7.0-rc.1"
},
"time": "2021-09-21T20:10:27+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",
"version": "v5.7.1",
"version": "v5.9.0",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-gutenberg-products-block.git",
"reference": "7dfe482d9b36f05f3d0ee78d74a26b49f3ebe6f1"
"reference": "d4f0040e6c41a2e02ce4dff1cd9fc8efe3113af1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/7dfe482d9b36f05f3d0ee78d74a26b49f3ebe6f1",
"reference": "7dfe482d9b36f05f3d0ee78d74a26b49f3ebe6f1",
"url": "https://api.github.com/repos/woocommerce/woocommerce-gutenberg-products-block/zipball/d4f0040e6c41a2e02ce4dff1cd9fc8efe3113af1",
"reference": "d4f0040e6c41a2e02ce4dff1cd9fc8efe3113af1",
"shasum": ""
},
"require": {
@ -586,8 +620,9 @@
"composer/installers": "^1.7.0"
},
"require-dev": {
"phpunit/phpunit": "7.5.20",
"woocommerce/woocommerce-sniffs": "0.1.0"
"woocommerce/woocommerce-sniffs": "0.1.0",
"wp-phpunit/wp-phpunit": "^5.4",
"yoast/phpunit-polyfills": "^1.0"
},
"type": "wordpress-plugin",
"extra": {
@ -612,7 +647,11 @@
"gutenberg",
"woocommerce"
],
"time": "2021-08-30T08:15:59+00:00"
"support": {
"issues": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues",
"source": "https://github.com/woocommerce/woocommerce-gutenberg-products-block/tree/v5.9.0"
},
"time": "2021-09-14T13:42:34+00:00"
}
],
"packages-dev": [
@ -660,6 +699,10 @@
"isolation",
"tool"
],
"support": {
"issues": "https://github.com/bamarni/composer-bin-plugin/issues",
"source": "https://github.com/bamarni/composer-bin-plugin/tree/master"
},
"time": "2020-05-03T08:27:20+00:00"
},
{
@ -714,6 +757,10 @@
"constructor",
"instantiate"
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/master"
},
"time": "2015-06-14T21:17:01+00:00"
},
{
@ -759,6 +806,10 @@
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.x"
},
"time": "2017-10-19T19:58:43+00:00"
},
{
@ -814,6 +865,10 @@
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/master"
},
"time": "2017-03-05T18:14:27+00:00"
},
{
@ -861,6 +916,10 @@
}
],
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/master"
},
"time": "2017-03-05T17:38:23+00:00"
},
{
@ -915,6 +974,10 @@
"reflection",
"static analysis"
],
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
"source": "https://github.com/phpDocumentor/ReflectionCommon/tree/master"
},
"time": "2017-09-11T18:02:19+00:00"
},
{
@ -967,6 +1030,10 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/release/4.x"
},
"time": "2019-12-28T18:55:12+00:00"
},
{
@ -1012,6 +1079,10 @@
"email": "me@mikevanriel.com"
}
],
"support": {
"issues": "https://github.com/phpDocumentor/TypeResolver/issues",
"source": "https://github.com/phpDocumentor/TypeResolver/tree/master"
},
"time": "2017-12-30T13:23:38+00:00"
},
{
@ -1075,6 +1146,10 @@
"spy",
"stub"
],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.10.3"
},
"time": "2020-03-05T15:02:03+00:00"
},
{
@ -1138,6 +1213,10 @@
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/5.3"
},
"time": "2018-04-06T15:36:58+00:00"
},
{
@ -1185,6 +1264,11 @@
"filesystem",
"iterator"
],
"support": {
"irc": "irc://irc.freenode.net/phpunit",
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/1.4.5"
},
"time": "2017-11-27T13:52:08+00:00"
},
{
@ -1226,6 +1310,10 @@
"keywords": [
"template"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
"source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1"
},
"time": "2015-06-21T13:50:34+00:00"
},
{
@ -1275,6 +1363,10 @@
"keywords": [
"timer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
"source": "https://github.com/sebastianbergmann/php-timer/tree/master"
},
"time": "2017-02-26T11:10:40+00:00"
},
{
@ -1324,6 +1416,10 @@
"keywords": [
"tokenizer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-token-stream/issues",
"source": "https://github.com/sebastianbergmann/php-token-stream/tree/master"
},
"abandoned": true,
"time": "2017-11-27T05:48:46+00:00"
},
@ -1409,6 +1505,10 @@
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/6.5.14"
},
"time": "2019-02-01T05:22:47+00:00"
},
{
@ -1468,6 +1568,10 @@
"mock",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit-mock-objects/issues",
"source": "https://github.com/sebastianbergmann/phpunit-mock-objects/tree/5.0.10"
},
"abandoned": true,
"time": "2018-08-09T05:50:03+00:00"
},
@ -1514,6 +1618,10 @@
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1584,6 +1692,10 @@
"compare",
"equality"
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/master"
},
"time": "2018-02-01T13:46:46+00:00"
},
{
@ -1636,6 +1748,10 @@
"keywords": [
"diff"
],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/master"
},
"time": "2017-08-03T08:09:46+00:00"
},
{
@ -1686,6 +1802,10 @@
"environment",
"hhvm"
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/master"
},
"time": "2017-07-01T08:51:00+00:00"
},
{
@ -1753,6 +1873,10 @@
"export",
"exporter"
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/3.1.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1810,6 +1934,10 @@
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0"
},
"time": "2017-04-27T15:39:26+00:00"
},
{
@ -1857,6 +1985,10 @@
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1908,6 +2040,10 @@
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
"source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -1967,6 +2103,10 @@
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
@ -2015,6 +2155,10 @@
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"support": {
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
"source": "https://github.com/sebastianbergmann/resource-operations/tree/master"
},
"time": "2015-07-28T20:34:47+00:00"
},
{
@ -2058,6 +2202,10 @@
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"support": {
"issues": "https://github.com/sebastianbergmann/version/issues",
"source": "https://github.com/sebastianbergmann/version/tree/master"
},
"time": "2016-10-03T07:35:21+00:00"
},
{
@ -2120,6 +2268,9 @@
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.19.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
@ -2174,6 +2325,10 @@
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/master"
},
"time": "2019-06-13T22:48:21+00:00"
},
{
@ -2223,6 +2378,10 @@
"check",
"validate"
],
"support": {
"issues": "https://github.com/webmozarts/assert/issues",
"source": "https://github.com/webmozarts/assert/tree/1.9.1"
},
"time": "2020-07-08T17:02:28+00:00"
},
{
@ -2282,6 +2441,10 @@
"polyfill",
"testing"
],
"support": {
"issues": "https://github.com/Yoast/PHPUnit-Polyfills/issues",
"source": "https://github.com/Yoast/PHPUnit-Polyfills"
},
"time": "2021-08-09T16:28:08+00:00"
}
],
@ -2297,5 +2460,5 @@
"platform-overrides": {
"php": "7.0"
},
"plugin-api-version": "1.1.0"
"plugin-api-version": "2.0.0"
}

View File

@ -10,6 +10,8 @@
* @package WooCommerce\Classes
*/
use Automattic\WooCommerce\Proxies\LegacyProxy;
use Automattic\WooCommerce\Utilities\ArrayUtil;
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
@ -1361,14 +1363,23 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
*/
public function add_product( $product, $qty = 1, $args = array() ) {
if ( $product ) {
$order = ArrayUtil::get_value_or_default( $args, 'order' );
$total = wc_get_price_excluding_tax(
$product,
array(
'qty' => $qty,
'order' => $order,
)
);
$default_args = array(
'name' => $product->get_name(),
'tax_class' => $product->get_tax_class(),
'product_id' => $product->is_type( 'variation' ) ? $product->get_parent_id() : $product->get_id(),
'variation_id' => $product->is_type( 'variation' ) ? $product->get_id() : 0,
'variation' => $product->is_type( 'variation' ) ? $product->get_attributes() : array(),
'subtotal' => wc_get_price_excluding_tax( $product, array( 'qty' => $qty ) ),
'total' => wc_get_price_excluding_tax( $product, array( 'qty' => $qty ) ),
'subtotal' => $total,
'total' => $total,
'quantity' => $qty,
);
} else {
@ -1392,7 +1403,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
}
$item = new WC_Order_Item_Product();
$item = wc_get_container()->get( LegacyProxy::class )->get_instance_of( WC_Order_Item_Product::class );
$item->set_props( $args );
$item->set_backorder_meta();
$item->set_order_id( $this->get_id() );

View File

@ -305,9 +305,11 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
);
}
if ( in_array( str_replace( 'edit-', '', $screen_id ), array_merge( array( 'shop_coupon', 'product' ), wc_get_order_types( 'order-meta-boxes' ) ) ) ) {
$post_id = isset( $post->ID ) ? $post->ID : '';
$currency = '';
$remove_item_notice = __( 'Are you sure you want to remove the selected items?', 'woocommerce' );
$post_id = isset( $post->ID ) ? $post->ID : '';
$currency = '';
$remove_item_notice = __( 'Are you sure you want to remove the selected items?', 'woocommerce' );
$remove_fee_notice = __( 'Are you sure you want to remove the selected fees?', 'woocommerce' );
$remove_shipping_notice = __( 'Are you sure you want to remove the selected shipping?', 'woocommerce' );
if ( $post_id && in_array( get_post_type( $post_id ), wc_get_order_types( 'order-meta-boxes' ) ) ) {
$order = wc_get_order( $post_id );
@ -322,6 +324,8 @@ if ( ! class_exists( 'WC_Admin_Assets', false ) ) :
$params = array(
'remove_item_notice' => $remove_item_notice,
'remove_fee_notice' => $remove_fee_notice,
'remove_shipping_notice' => $remove_shipping_notice,
'i18n_select_items' => __( 'Please select some items.', 'woocommerce' ),
'i18n_do_refund' => __( 'Are you sure you wish to process this refund? This action cannot be undone.', 'woocommerce' ),
'i18n_delete_refund' => __( 'Are you sure you wish to delete this refund? This action cannot be undone.', 'woocommerce' ),

View File

@ -66,11 +66,36 @@ $row_class = apply_filters( 'woocommerce_admin_html_order_item_class', ! empt
}
?>
</div>
<?php
$step = apply_filters( 'woocommerce_quantity_input_step', '1', $product );
/**
* Filter to change the product quantity stepping in the order editor of the admin area.
*
* @since 5.8.0
* @param string $step The current step amount to be used in the quantity editor.
* @param WC_Product $product The product that is being edited.
* @param string $context The context in which the quantity editor is shown, 'edit' or 'refund'.
*/
$step_edit = apply_filters( 'woocommerce_quantity_input_step_admin', $step, $product, 'edit' );
$step_refund = apply_filters( 'woocommerce_quantity_input_step_admin', $step, $product, 'refund' );
/**
* Filter to change the product quantity minimum in the order editor of the admin area.
*
* @since 5.8.0
* @param string $step The current minimum amount to be used in the quantity editor.
* @param WC_Product $product The product that is being edited.
* @param string $context The context in which the quantity editor is shown, 'edit' or 'refund'.
*/
$min_edit = apply_filters( 'woocommerce_quantity_input_min_admin', '0', $product, 'edit' );
$min_refund = apply_filters( 'woocommerce_quantity_input_min_admin', '0', $product, 'refund' );
?>
<div class="edit" style="display: none;">
<input type="number" step="<?php echo esc_attr( apply_filters( 'woocommerce_quantity_input_step', '1', $product ) ); ?>" min="0" autocomplete="off" name="order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" value="<?php echo esc_attr( $item->get_quantity() ); ?>" data-qty="<?php echo esc_attr( $item->get_quantity() ); ?>" size="4" class="quantity" />
<input type="number" step="<?php echo esc_attr( $step_edit ); ?>" min="<?php echo esc_attr( $min_edit ); ?>" autocomplete="off" name="order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" value="<?php echo esc_attr( $item->get_quantity() ); ?>" data-qty="<?php echo esc_attr( $item->get_quantity() ); ?>" size="4" class="quantity" />
</div>
<div class="refund" style="display: none;">
<input type="number" step="<?php echo esc_attr( apply_filters( 'woocommerce_quantity_input_step', '1', $product ) ); ?>" min="0" max="<?php echo absint( $item->get_quantity() ); ?>" autocomplete="off" name="refund_order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" size="4" class="refund_order_item_qty" />
<input type="number" step="<?php echo esc_attr( $step_refund ); ?>" min="<?php echo esc_attr( $min_refund ); ?>" max="<?php echo absint( $item->get_quantity() ); ?>" autocomplete="off" name="refund_order_item_qty[<?php echo absint( $item_id ); ?>]" placeholder="0" size="4" class="refund_order_item_qty" />
</div>
</td>
<td class="line_cost" width="1%" data-sort-value="<?php echo esc_attr( $item->get_total() ); ?>">

View File

@ -932,6 +932,7 @@ class WC_AJAX {
// Add items to order.
$order_notes = array();
$added_items = array();
foreach ( $items_to_add as $item ) {
if ( ! isset( $item['id'], $item['qty'] ) || empty( $item['id'] ) ) {
@ -955,7 +956,7 @@ class WC_AJAX {
/* translators: %s: error message */
throw new Exception( sprintf( __( 'Error: %s', 'woocommerce' ), $validation_error->get_error_message() ) );
}
$item_id = $order->add_product( $product, $qty );
$item_id = $order->add_product( $product, $qty, array( 'order' => $order ) );
$item = apply_filters( 'woocommerce_ajax_order_item', $order->get_item( $item_id ), $item_id, $order, $product );
$added_items[ $item_id ] = $item;
$order_notes[ $item_id ] = $product->get_formatted_name();

View File

@ -269,9 +269,10 @@ class WC_Download_Handler {
str_replace( 'https:', 'http:', site_url( '/', 'http' ) ) => ABSPATH,
);
$file_path = str_replace( array_keys( $replacements ), array_values( $replacements ), $file_path );
$count = 0;
$file_path = str_replace( array_keys( $replacements ), array_values( $replacements ), $file_path, $count );
$parsed_file_path = wp_parse_url( $file_path );
$remote_file = true;
$remote_file = null === $count || 0 === $count; // Remote file only if there were no replacements.
// Paths that begin with '//' are always remote URLs.
if ( '//' === substr( $file_path, 0, 2 ) ) {
@ -291,7 +292,7 @@ class WC_Download_Handler {
$file_path = realpath( WP_CONTENT_DIR . substr( $file_path, 11 ) );
// Check if we have an absolute path.
} elseif ( ( ! isset( $parsed_file_path['scheme'] ) || ! in_array( $parsed_file_path['scheme'], array( 'http', 'https', 'ftp' ), true ) ) && isset( $parsed_file_path['path'] ) && file_exists( $parsed_file_path['path'] ) ) {
} elseif ( ( ! isset( $parsed_file_path['scheme'] ) || ! in_array( $parsed_file_path['scheme'], array( 'http', 'https', 'ftp' ), true ) ) && isset( $parsed_file_path['path'] ) ) {
$remote_file = false;
$file_path = $parsed_file_path['path'];
}

View File

@ -95,22 +95,16 @@ class WC_Product_Download implements ArrayAccess {
* @return boolean
*/
public function is_allowed_filetype() {
$file_path = $this->get_file();
$file_path = $this->get_file();
$parsed_file_path = WC_Download_Handler::parse_file_path( $file_path );
// File types for URL-based files located on the server should get validated.
$is_file_on_server = false;
if ( false !== stripos( $file_path, network_site_url( '/', 'https' ) ) ||
false !== stripos( $file_path, network_site_url( '/', 'http' ) ) ||
false !== stripos( $file_path, site_url( '/', 'https' ) ) ||
false !== stripos( $file_path, site_url( '/', 'http' ) )
) {
$is_file_on_server = true;
}
$is_file_on_server = ! $parsed_file_path['remote_file'];
if ( ! $is_file_on_server && 'relative' !== $this->get_type_of_file_path() ) {
return true;
}
return ! $this->get_file_extension() || in_array( $this->get_file_type(), $this->get_allowed_mime_types(), true );
return ( ! $is_file_on_server && ! $this->get_file_extension() ) || in_array( $this->get_file_type(), $this->get_allowed_mime_types(), true );
}
/**
@ -177,6 +171,10 @@ class WC_Product_Download implements ArrayAccess {
if ( preg_match( '#^//+(/[^/].+)$#i', $value, $matches ) ) {
$value = $matches[1];
}
$parsed_file_path = WC_Download_Handler::parse_file_path( $value );
$value = $parsed_file_path['file_path'];
switch ( $this->get_type_of_file_path( $value ) ) {
case 'absolute':
$this->data['file'] = esc_url_raw( $value );

View File

@ -9,6 +9,8 @@
*/
use Automattic\Jetpack\Constants;
use Automattic\WooCommerce\Proxies\LegacyProxy;
use Automattic\WooCommerce\Utilities\ArrayUtil;
use Automattic\WooCommerce\Utilities\NumberUtil;
defined( 'ABSPATH' ) || exit;
@ -1081,7 +1083,9 @@ function wc_get_price_excluding_tax( $product, $args = array() ) {
$line_price = $price * $qty;
if ( $product->is_taxable() && wc_prices_include_tax() ) {
$tax_rates = WC_Tax::get_rates( $product->get_tax_class() );
$order = ArrayUtil::get_value_or_default( $args, 'order' );
$customer = $order ? wc_get_container()->get( LegacyProxy::class )->get_instance_of( WC_Customer::class, $order->get_customer_id() ) : null;
$tax_rates = WC_Tax::get_rates( $product->get_tax_class(), $customer );
$base_tax_rates = WC_Tax::get_base_tax_rates( $product->get_tax_class( 'unfiltered' ) );
$remove_taxes = apply_filters( 'woocommerce_adjust_non_base_location_prices', true ) ? WC_Tax::calc_tax( $line_price, $base_tax_rates, true ) : WC_Tax::calc_tax( $line_price, $tax_rates, true );
$return_price = $line_price - array_sum( $remove_taxes ); // Unrounded since we're dealing with tax inclusive prices. Matches logic in cart-totals class. @see adjust_non_base_location_price.

View File

@ -4,7 +4,7 @@ Tags: e-commerce, store, sales, sell, woo, shop, cart, checkout, downloadable, d
Requires at least: 5.6
Tested up to: 5.8
Requires PHP: 7.0
Stable tag: 5.6.0
Stable tag: 5.7.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -160,6 +160,6 @@ WooCommerce comes with some sample data you can use to see how products look; im
== Changelog ==
= 5.7.0 2021-09-xx =
= 5.8.0 2021-10-xx =
[See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce/trunk/changelog.txt).

View File

@ -130,16 +130,10 @@ class LookupDataStore {
public function check_lookup_table_exists() {
global $wpdb;
$query = $wpdb->prepare(
'SELECT count(*)
FROM information_schema.tables
WHERE table_schema = DATABASE()
AND table_name = %s;',
$this->lookup_table_name
);
$query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $this->lookup_table_name ) );
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
return (bool) $wpdb->get_var( $query );
return $this->lookup_table_name === $wpdb->get_var( $query );
}
/**

View File

@ -12,6 +12,9 @@ wp plugin install https://github.com/WP-API/Basic-Auth/archive/master.zip --acti
# install the WP Mail Logging plugin to test emails
wp plugin install wp-mail-logging --activate
# initialize pretty permalinks
wp rewrite structure /%postname%/
echo "Updating to WordPress Nightly Point Release"
wp core update https://wordpress.org/nightly-builds/wordpress-latest.zip

View File

@ -16,3 +16,6 @@ wp plugin install https://github.com/WP-API/Basic-Auth/archive/master.zip --acti
# install the WP Mail Logging plugin to test emails
wp plugin install wp-mail-logging --activate
# initialize pretty permalinks
wp rewrite structure /%postname%/

View File

@ -12,6 +12,8 @@ return array(
'get_bloginfo',
'get_woocommerce_currencies',
'get_woocommerce_currency_symbol',
'wc_get_price_excluding_tax',
'wc_get_shipping_method_count',
'wc_prices_include_tax',
'wc_site_is_https',
);

View File

@ -152,7 +152,7 @@ class WC_Tests_Customer_Functions extends WC_Unit_Test_Case {
// Test download permissions.
$prod_download = new WC_Product_Download();
$prod_download->set_file( plugin_dir_url( __FILE__ ) . '/assets/images/help.png' );
$prod_download->set_file( WC_ABSPATH . 'assets/images/help.png' );
$prod_download->set_id( 'download' );
$product = new WC_Product_Simple();
@ -382,7 +382,7 @@ class WC_Tests_Customer_Functions extends WC_Unit_Test_Case {
$customer_id = wc_create_new_customer( 'test@example.com', 'testuser', 'testpassword' );
$prod_download = new WC_Product_Download();
$prod_download->set_file( plugin_dir_url( __FILE__ ) . '/assets/images/help.png' );
$prod_download->set_file( WC_ABSPATH . 'assets/images/help.png' );
$prod_download->set_id( 1 );
$product = new WC_Product_Simple();

View File

@ -5,6 +5,8 @@
* @package WooCommerce\Tests\Abstracts
*/
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\FunctionsMockerHack;
/**
* Class WC_Abstract_Order.
*/
@ -100,12 +102,12 @@ class WC_Abstract_Order_Test extends WC_Unit_Test_Case {
update_option( 'woocommerce_default_country', 'IN:AP' );
$tax_rate = array(
'tax_rate_country' => 'IN',
'tax_rate_state' => '',
'tax_rate' => '25.0000',
'tax_rate_name' => 'tax',
'tax_rate_order' => '1',
'tax_rate_class' => '',
'tax_rate_country' => 'IN',
'tax_rate_state' => '',
'tax_rate' => '25.0000',
'tax_rate_name' => 'tax',
'tax_rate_order' => '1',
'tax_rate_class' => '',
);
WC_Tax::_insert_tax_rate( $tax_rate );
@ -137,4 +139,49 @@ class WC_Abstract_Order_Test extends WC_Unit_Test_Case {
$this->assertEquals( 2, $order->get_discount_tax() );
}
/**
* @testdox 'add_product' passes the order supplied in '$args' to 'wc_get_price_excluding_tax', and uses the obtained price as total and subtotal for the line item.
*/
public function test_add_product_passes_order_to_wc_get_price_excluding_tax() {
$product_passed_to_get_price = false;
$args_passed_to_get_price = false;
FunctionsMockerHack::add_function_mocks(
array(
'wc_get_price_excluding_tax' => function( $product, $args = array() ) use ( &$product_passed_to_get_price, &$args_passed_to_get_price ) {
$product_passed_to_get_price = $product;
$args_passed_to_get_price = $args;
return 1234;
},
)
);
//phpcs:disable Squiz.Commenting
$order_item = new class() extends WC_Order_Item_Product {
public $passed_props;
public function set_props( $args, $context = 'set' ) {
$this->passed_props = $args;
}
};
//phpcs:enable Squiz.Commenting
$this->register_legacy_proxy_class_mocks(
array( 'WC_Order_Item_Product' => $order_item )
);
$product = WC_Helper_Product::create_simple_product();
$product->set_regular_price( 100 );
$product->save();
$order = wc_create_order();
$order->add_product( $product, 1, array( 'order' => $order ) );
$this->assertSame( $product, $product_passed_to_get_price );
$this->assertSame( $order, $args_passed_to_get_price['order'] );
$this->assertEquals( 1234, $order_item->passed_props['total'] );
$this->assertEquals( 1234, $order_item->passed_props['subtotal'] );
}
}

View File

@ -0,0 +1,50 @@
<?php
/**
* Class WC_Product_Download_Test.
*/
class WC_Product_Download_Test extends WC_Unit_Test_Case {
/**
* Helper utitility to get mocked object of WC_Product_Download class.
*
* @return WC_Product_Download
*/
public function get_sut_with_get_file() {
return $this->getMockBuilder( WC_Product_Download::class )
->setMethods( array( 'get_file' ) )
->getMock();
}
/**
* Test when file appears remote but is local.
*/
public function test_is_allowed_filetype_when_file_with_false_query_params() {
$download = $this->get_sut_with_get_file();
$payload = trailingslashit( site_url( '/' ) ) . 'non_exists/?/../../wp-config.php';
$download->method( 'get_file' )->willReturn( $payload );
$this->assertFalse( $download->is_allowed_filetype() );
}
/**
* Test when file appears remote, but is local and tries to appear remote by having characters to be stripped by esc_url_raw.
*/
public function test_is_allowed_filetype_when_file_with_quote_and_false_query_params() {
$download = $this->get_sut_with_get_file();
$payload = trailingslashit( site_url( '/' ) ) . '"non_exists/?/../../foo.php';
$download->method( 'get_file' )->willReturn( $payload );
$this->assertFalse( $download->is_allowed_filetype() );
}
/**
* Test when file has invalid scheme.
*/
public function test_is_allowed_filetype_when_file_with_url_escapable_scheme() {
$download = $this->get_sut_with_get_file();
$payload = trailingslashit( site_url( '/' ) );
$payload = str_replace( 'http', 'http;', $payload );
$payload = trailingslashit( $payload ) . 'wp-config.php?/../../foo'; // http;//example.com/wp-config.php?/../../foo.
$download->method( 'get_file' )->willReturn( $payload );
$this->assertFalse( $download->is_allowed_filetype() );
}
}

View File

@ -0,0 +1,97 @@
<?php
/**
* Unit tests for wc-product-functions.php.
*
* @package WooCommerce\Tests\Functions\Stock
*/
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\FunctionsMockerHack;
use Automattic\WooCommerce\Testing\Tools\CodeHacking\Hacks\StaticMockerHack;
/**
* Class WC_Stock_Functions_Tests.
*/
class WC_Product_Functions_Tests extends \WC_Unit_Test_Case {
/**
* @testdox If 'wc_get_price_excluding_tax' gets an order as argument, it passes the order customer to 'WC_Tax::get_rates'.
*
* @testWith [true]
* [false]
*
* @param bool $pass_order Whether an order is passed to 'wc_get_price_excluding_tax' or not.
*/
public function test_wc_get_price_excluding_tax_passes_order_customer_to_get_rates_if_order_is_available( $pass_order ) {
$customer_passed_to_get_rates = false;
$customer_id_passed_to_wc_customer_constructor = false;
FunctionsMockerHack::add_function_mocks(
array(
'wc_prices_include_tax' => '__return_true',
)
);
StaticMockerHack::add_method_mocks(
array(
'WC_Tax' =>
array(
'get_rates' => function( $tax_class, $customer ) use ( &$customer_passed_to_get_rates ) {
$customer_passed_to_get_rates = $customer;
},
'get_base_tax_rates' => function( $tax_class ) {
return 0;
},
'calc_tax' => function( $price, $rates, $price_includes_tax = false, $deprecated = false ) {
return array( 0 );
},
),
)
);
// phpcs:disable Squiz.Commenting.FunctionComment.Missing
$product = new class() extends WC_Product {
public function get_price( $context = 'view' ) {
return 0;
}
public function is_taxable() {
return true;
}
public function get_tax_class( $context = 'view' ) {
return '';
}
};
$customer = new stdClass();
$this->register_legacy_proxy_class_mocks(
array(
'WC_Customer' => function( $customer_id ) use ( &$customer_id_passed_to_wc_customer_constructor, $customer ) {
$customer_id_passed_to_wc_customer_constructor = $customer_id;
return $customer;
},
)
);
if ( $pass_order ) {
$order = new class() {
public function get_customer_id() {
return 1;
}
};
wc_get_price_excluding_tax( $product, array( 'order' => $order ) );
$this->assertEquals( $order->get_customer_id(), $customer_id_passed_to_wc_customer_constructor );
$this->assertSame( $customer, $customer_passed_to_get_rates );
} else {
wc_get_price_excluding_tax( $product );
$this->assertFalse( $customer_id_passed_to_wc_customer_constructor );
$this->assertNull( $customer_passed_to_get_rates );
}
// phpcs:enable Squiz.Commenting.FunctionComment.Missing
}
}