Merge branch 'woocommerce:trunk' into fix/30209

This commit is contained in:
Nagesh Pai 2022-01-01 19:19:03 +05:30 committed by GitHub
commit 6bff4ff4d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 227 additions and 75 deletions

View File

@ -1,5 +1,9 @@
# Unreleased
## Added
- Added low stock threshold field for products
# 0.2.0
## Added

View File

@ -34,7 +34,7 @@ abstract class AbstractProductInventory extends Model {
*
* @type {StockStatus}
*/
public readonly stockStatus: StockStatus = ''
public readonly stockStatus: StockStatus = '';
/**
* The status of backordering for a product.
@ -56,6 +56,13 @@ abstract class AbstractProductInventory extends Model {
* @type {boolean}
*/
public readonly isOnBackorder: boolean = false;
/**
* Indicates the threshold for when the low stock notification will be sent to the merchant.
*
* @type {number}
*/
public readonly lowStockThreshold: number = -1;
}
export interface IProductInventory extends AbstractProductInventory {}

View File

@ -53,7 +53,7 @@ export type ProductGroupedUpdateParams = 'groupedProducts';
* Properties related to tracking inventory.
*/
export type ProductInventoryUpdateParams = 'backorderStatus' | 'canBackorder' | 'trackInventory'
| 'onePerOrder' | 'remainingStock';
| 'onePerOrder' | 'remainingStock' | 'lowStockThreshold';
/**
* Properties related to sales tax.

View File

@ -130,10 +130,11 @@ export class SimpleProduct extends AbstractProduct implements
public readonly onePerOrder: boolean = false;
public readonly trackInventory: boolean = false;
public readonly remainingStock: number = -1;
public readonly stockStatus: StockStatus = ''
public readonly stockStatus: StockStatus = '';
public readonly backorderStatus: BackorderStatus = BackorderStatus.Allowed;
public readonly canBackorder: boolean = false;
public readonly isOnBackorder: boolean = false;
public readonly lowStockThreshold: number = -1;
/**
* @see ./abstracts/price.ts

View File

@ -115,10 +115,11 @@ export class VariableProduct extends AbstractProduct implements
public readonly onePerOrder: boolean = false;
public readonly trackInventory: boolean = false;
public readonly remainingStock: number = -1;
public readonly stockStatus: StockStatus = ''
public readonly stockStatus: StockStatus = '';
public readonly backorderStatus: BackorderStatus = BackorderStatus.Allowed;
public readonly canBackorder: boolean = false;
public readonly isOnBackorder: boolean = false;
public readonly lowStockThreshold: number = -1;
/**
* @see ./abstracts/sales-tax.ts

View File

@ -118,6 +118,7 @@ export class ProductVariation extends AbstractProductData implements
public readonly backorderStatus: BackorderStatus = BackorderStatus.Allowed;
public readonly canBackorder: boolean = false;
public readonly isOnBackorder: boolean = false;
public readonly lowStockThreshold: number = -1;
/**
* @see ./abstracts/price.ts

View File

@ -345,6 +345,7 @@ export function createProductInventoryTransformation(): ModelTransformation[] {
onePerOrder: PropertyType.Boolean,
stockStatus: PropertyType.String,
backOrderStatus: PropertyType.String,
lowStockThreshold: PropertyType.Integer,
},
),
new KeyChangeTransformation< IProductInventory >(
@ -356,6 +357,7 @@ export function createProductInventoryTransformation(): ModelTransformation[] {
backorderStatus: 'backorders',
canBackorder: 'backorders_allowed',
isOnBackorder: 'backordered',
lowStockThreshold: 'low_stock_amount',
},
),
];

View File

@ -4,6 +4,7 @@
- Added `post-results-to-github-pr.js` to post smoke test results to a GitHub PR.
- Added jest flags to generate a json test report
- Added more entries to `default.json`
## Added

View File

@ -2,75 +2,207 @@
"url": "http://localhost:8084/",
"appName": "woocommerce_e2e",
"users": {
"admin": {
"username": "admin",
"password": "password"
},
"customer": {
"username": "customer",
"password": "password"
}
"admin": {
"username": "admin",
"password": "password"
},
"customer": {
"username": "customer",
"password": "password"
}
},
"products": {
"simple": {
"name": "Simple product"
},
"variable": {
"name": "Variable Product with Three Variations"
}
"simple": {
"name": "Simple product"
},
"variable": {
"name": "Variable Product with Three Attributes",
"defaultAttributes": [
{
"id": 0,
"name": "Size",
"option": "Medium"
},
{
"id": 0,
"name": "Colour",
"option": "Blue"
}
],
"attributes": [
{
"id": 0,
"name": "Colour",
"isVisibleOnProductPage": true,
"isForVariations": true,
"options": [
"Red",
"Green",
"Blue"
],
"sortOrder": 0
},
{
"id": 0,
"name": "Size",
"isVisibleOnProductPage": true,
"isForVariations": true,
"options": [
"Small",
"Medium",
"Large"
],
"sortOrder": 0
},
{
"id": 0,
"name": "Logo",
"isVisibleOnProductPage": true,
"isForVariations": true,
"options": [
"Woo",
"WordPress"
],
"sortOrder": 0
}
]
},
"variations": [
{
"regularPrice": "19.99",
"attributes": [
{
"name": "Size",
"option": "Large"
},
{
"name": "Colour",
"option": "Red"
}
]
},
{
"regularPrice": "18.99",
"attributes": [
{
"name": "Size",
"option": "Medium"
},
{
"name": "Colour",
"option": "Green"
}
]
},
{
"regularPrice": "17.99",
"attributes": [
{
"name": "Size",
"option": "Small"
},
{
"name": "Colour",
"option": "Blue"
}
]
}
],
"grouped": {
"name": "Grouped Product with Three Children",
"groupedProducts": [
{
"name": "Base Unit",
"regularPrice": "29.99"
},
{
"name": "Add-on A",
"regularPrice": "11.95"
},
{
"name": "Add-on B",
"regularPrice": "18.97"
}
]
},
"external": {
"name": "External product",
"regularPrice": "24.99",
"buttonText": "Buy now",
"externalUrl": "https://wordpress.org/plugins/woocommerce"
}
},
"coupons": {
"percentage": {
"code": "20percent",
"discountType": "percent",
"amount": "20.00"
}
},
"addresses": {
"admin": {
"store": {
"firstname": "John",
"lastname": "Doe",
"company": "Automattic",
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"countryandstate": "United States (US) — California",
"city": "San Francisco",
"state": "CA",
"postcode": "94107"
}
},
"customer": {
"billing": {
"firstname": "John",
"lastname": "Doe",
"company": "Automattic",
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"city": "San Francisco",
"state": "CA",
"postcode": "94107",
"phone": "123456789",
"email": "john.doe@example.com"
},
"shipping": {
"firstname": "John",
"lastname": "Doe",
"company": "Automattic",
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"city": "San Francisco",
"state": "CA",
"postcode": "94107"
}
}
"admin": {
"store": {
"email": "admin@woocommercecoree2etestsuite.com",
"firstname": "John",
"lastname": "Doe",
"company": "Automattic",
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"countryandstate": "United States (US) — California",
"city": "San Francisco",
"state": "CA",
"postcode": "94107"
}
},
"customer": {
"billing": {
"firstname": "John",
"lastname": "Doe",
"company": "Automattic",
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"city": "San Francisco",
"state": "CA",
"postcode": "94107",
"phone": "123456789",
"email": "john.doe@example.com"
},
"shipping": {
"firstname": "John",
"lastname": "Doe",
"company": "Automattic",
"country": "United States (US)",
"addressfirstline": "addr 1",
"addresssecondline": "addr 2",
"city": "San Francisco",
"state": "CA",
"postcode": "94107"
}
}
},
"orders": {
"basicPaidOrder": {
"paymentMethod": "cod",
"status": "processing",
"billing": {
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com"
}
}
},
"onboardingwizard": {
"industry": "Test industry",
"numberofproducts": "1 - 10",
"sellingelsewhere": "No"
"industry": "Test industry",
"numberofproducts": "1 - 10",
"sellingelsewhere": "No"
},
"settings": {
"shipping": {
"zonename": "United States",
"zoneregions": "United States (US)",
"shippingmethod": "Free shipping"
}
"shipping": {
"zonename": "United States",
"zoneregions": "United States (US)",
"shippingmethod": "Free shipping"
}
}
}

View File

@ -21,7 +21,7 @@
"pelago/emogrifier": "3.1.0",
"psr/container": "1.0.0",
"woocommerce/action-scheduler": "3.4.0",
"woocommerce/woocommerce-admin": "3.0.0-rc.1",
"woocommerce/woocommerce-admin": "3.0.1",
"woocommerce/woocommerce-blocks": "6.5.1"
},
"require-dev": {

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": "ecce1670d22ae2df07e552adce1cfc29",
"content-hash": "ebdb5708b79cdb94e4b2ff5fbed40d89",
"packages": [
{
"name": "automattic/jetpack-autoloader",
@ -543,16 +543,16 @@
},
{
"name": "woocommerce/woocommerce-admin",
"version": "3.0.0-rc.1",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/woocommerce/woocommerce-admin.git",
"reference": "7c0cdd01ae98be058d684dd19023b0f40094cb63"
"reference": "5542e80021a43d24ab9b1d2d67083b608899835d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/7c0cdd01ae98be058d684dd19023b0f40094cb63",
"reference": "7c0cdd01ae98be058d684dd19023b0f40094cb63",
"url": "https://api.github.com/repos/woocommerce/woocommerce-admin/zipball/5542e80021a43d24ab9b1d2d67083b608899835d",
"reference": "5542e80021a43d24ab9b1d2d67083b608899835d",
"shasum": ""
},
"require": {
@ -608,9 +608,9 @@
"homepage": "https://github.com/woocommerce/woocommerce-admin",
"support": {
"issues": "https://github.com/woocommerce/woocommerce-admin/issues",
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v3.0.0-rc.1"
"source": "https://github.com/woocommerce/woocommerce-admin/tree/v3.0.1"
},
"time": "2021-12-14T23:55:42+00:00"
"time": "2021-12-30T18:38:11+00:00"
},
{
"name": "woocommerce/woocommerce-blocks",

View File

@ -484,12 +484,15 @@ function wc_is_file_valid_csv( $file, $check_path = true ) {
}
/**
* Check if the current theme is an FSE theme.
* Check if the current theme is a block theme.
*
* @since x.x.x
* @return bool
*/
function wc_current_theme_is_fse_theme() {
if ( function_exists( 'wp_is_block_theme' ) ) {
return (bool) wp_is_block_theme();
}
if ( function_exists( 'gutenberg_is_fse_theme' ) ) {
return (bool) gutenberg_is_fse_theme();
}