Updated check for default category

This commit is contained in:
jamelreid 2021-12-01 15:48:31 -05:00
parent 6fa14b0b6c
commit 3a39d7d9fc
1 changed files with 1 additions and 1 deletions

View File

@ -138,7 +138,7 @@ export const withRestApi = {
if ( productCategories.data && productCategories.data.length ) {
for ( let c = 0; c < productCategories.data.length; c++ ) {
// The default `uncategorized` category can't be deleted
if ( productCategories.data[c].id == 0 ) {
if ( productCategories.data[c].slug == 'uncategorized' ) {
continue;
}
const response = await client.delete( productCategoriesPath + `/${productCategories.data[c].id}?force=true` );