Back to Woocommerce

System status tools

docs/apis/rest-api/v2/system-status-tools.mdx

10.9.0-dev14.2 KB
Original Source

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

System status tools

The system status tools API allows you to view and run tools from system status.

System status tool properties

AttributeTypeDescription
idstringA unique identifier for the tool. READ-ONLY
namestringTool name. READ-ONLY
actionstringWhat running the tool will do. READ-ONLY
descriptionstringTool description. READ-ONLY
successbooleanDid the tool run successfully? READ-ONLY WRITE-ONLY
messagestringTool return message. READ-ONLY WRITE-ONLY
confirmbooleanConfirm execution of the tool. Default is false. WRITE-ONLY

Retrieve a tool from system status

This API lets you retrieve and view a specific tool from system status by ID.

http
GET /wp-json/wc/v2/system_status/tools/<id>
<Tabs> <TabItem value="curl" label="cURL">
shell
curl https://example.com/wp-json/wc/v2/system_status/tools/clear_transients \
	-u consumer_key:consumer_secret
</TabItem> <TabItem value="js" label="JavaScript">
javascript
WooCommerce.get("system_status/tools/clear_transients")
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
</TabItem> <TabItem value="php" label="PHP">
php
<?php print_r($woocommerce->get('system_status/tools/clear_transients')); ?>
</TabItem> <TabItem value="python" label="Python">
python
print(wcapi.get("system_status/tools/clear_transients").json())
</TabItem> <TabItem value="ruby" label="Ruby">
ruby
woocommerce.get("system_status/tools/clear_transients").parsed_response
</TabItem> <TabItem value="response" label="JSON Response">
json
{
  "id": "clear_transients",
  "name": "WC transients",
  "action": "Clear transients",
  "description": "This tool will clear the product/shop transients cache.",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_transients"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v2/system_status/tools"
      }
    ]
  }
}
</TabItem> </Tabs>

List all tools from system status

This API helps you to view all tools from system status.

http
GET /wp-json/wc/v2/system_status/tools
<Tabs> <TabItem value="curl" label="cURL">
shell
curl https://example.com/wp-json/wc/v2/system_status/tools \
	-u consumer_key:consumer_secret
</TabItem> <TabItem value="js" label="JavaScript">
javascript
WooCommerce.get("system_status/tools")
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
</TabItem> <TabItem value="php" label="PHP">
php
<?php print_r($woocommerce->get('system_status/tools')); ?>
</TabItem> <TabItem value="python" label="Python">
python
print(wcapi.get("system_status/tools").json())
</TabItem> <TabItem value="ruby" label="Ruby">
ruby
woocommerce.get("system_status/tools").parsed_response
</TabItem> <TabItem value="response" label="JSON Response">
json
[
  {
    "id": "clear_transients",
    "name": "WC transients",
    "action": "Clear transients",
    "description": "This tool will clear the product/shop transients cache.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_transients"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "clear_expired_transients",
    "name": "Expired transients",
    "action": "Clear expired transients",
    "description": "This tool will clear ALL expired transients from WordPress.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_expired_transients"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "delete_orphaned_variations",
    "name": "Orphaned variations",
    "action": "Delete orphaned variations",
    "description": "This tool will delete all variations which have no parent.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/delete_orphaned_variations"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "clear_expired_download_permissions",
    "name": "Used-up download permissions",
    "action": "Clean up download permissions",
    "description": "This tool will delete expired download permissions and permissions with 0 remaining downloads.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_expired_download_permissions"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "regenerate_product_lookup_tables",
    "name": "Product lookup tables",
    "action": "Regenerate",
    "description": "This tool will regenerate product lookup table data. This process may take a while.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/regenerate_product_lookup_tables"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "repair_coupons_lookup_table",
    "name": "Coupons lookup table",
    "action": "Repair",
    "description": "This tool will repair the coupons lookup table data with missing discount amounts. This process may take a while.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/repair_coupons_lookup_table"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "recount_terms",
    "name": "Term counts",
    "action": "Recount terms",
    "description": "This tool will recount product terms - useful when changing your settings in a way which hides products from the catalog.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/recount_terms"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "reset_roles",
    "name": "Capabilities",
    "action": "Reset capabilities",
    "description": "This tool will reset the admin, customer and shop_manager roles to default. Use this if your users cannot access all of the WooCommerce admin pages.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/reset_roles"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "clear_sessions",
    "name": "Customer sessions",
    "action": "Clear all sessions",
    "description": "<strong class=\"red\">Note:</strong> This tool will delete all customer session data from the database, including any current live carts.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_sessions"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "clear_template_cache",
    "name": "Clear template cache",
    "action": "Clear",
    "description": "<strong class=\"red\">Note:</strong> This tool will empty the template cache.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_template_cache"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "clear_system_status_theme_info_cache",
    "name": "Clear system status theme info cache",
    "action": "Clear",
    "description": "<strong class=\"red\">Note:</strong> This tool will empty the system status theme info cache.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_system_status_theme_info_cache"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "install_pages",
    "name": "Install WooCommerce pages",
    "action": "Install pages",
    "description": "<strong class=\"red\">Note:</strong> This tool will install all the missing WooCommerce pages. Pages already defined and set up will not be replaced.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/install_pages"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "delete_taxes",
    "name": "Delete all WooCommerce tax rates",
    "action": "Delete ALL tax rates",
    "description": "<strong class=\"red\">Note:</strong> This option will delete ALL of your tax rates, use with caution.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/delete_taxes"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "regenerate_thumbnails",
    "name": "Regenerate shop thumbnails",
    "action": "Regenerate",
    "description": "This will regenerate all shop thumbnails to match your theme and/or image settings.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/regenerate_thumbnails"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "db_update_routine",
    "name": "Update database",
    "action": "Update database",
    "description": "<strong class=\"red\">Note:</strong> This tool will update your WooCommerce database to the latest version. Please ensure you make sufficient backups before proceeding.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/db_update_routine"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "recreate_order_address_fts_index",
    "name": "Re-create Order Address FTS index",
    "action": "Recreate index",
    "description": "This tool will recreate the full text search index for order addresses. If the index does not exist, it will try to create it.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/recreate_order_address_fts_index"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  },
  {
    "id": "verify_db_tables",
    "name": "Verify base database tables",
    "action": "Verify database",
    "description": "Verify if all base database tables are present.",
    "_links": {
      "self": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools/verify_db_tables"
        }
      ],
      "collection": [
        {
          "href": "https://example.com/wp-json/wc/v2/system_status/tools"
        }
      ]
    }
  }
]
</TabItem> </Tabs>

Run a tool from system status

This API lets you run a tool from system status.

http
PUT /wp-json/wc/v2/system_status/tools/<id>
<Tabs> <TabItem value="curl" label="cURL">
shell
curl -X PUT https://example.com/wp-json/wc/v2/system_status/tools/clear_transients \
	-u consumer_key:consumer_secret \
	-H "Content-Type: application/json" \
	-d '{
  "confirm": true
}'
</TabItem> <TabItem value="js" label="JavaScript">
javascript
const data = {
  confirm: true
};

WooCommerce.put("system_status/tools/clear_transients", data)
  .then((response) => {
    console.log(response.data);
  })
  .catch((error) => {
    console.log(error.response.data);
  });
</TabItem> <TabItem value="php" label="PHP">
php
<?php
$data = [
    'confirm' => true
];

print_r($woocommerce->put('system_status/tools/clear_transients', $data));
?>
</TabItem> <TabItem value="python" label="Python">
python
data = {
    "confirm": True
}

print(wcapi.put("system_status/tools/clear_transients", data).json())
</TabItem> <TabItem value="ruby" label="Ruby">
ruby
data = {
  confirm: true
}

woocommerce.put("system_status/tools/clear_transients", data).parsed_response
</TabItem> <TabItem value="response" label="JSON Response">
json
{
  "id": "clear_transients",
  "name": "WC transients",
  "action": "Clear transients",
  "description": "This tool will clear the product/shop transients cache.",
  "success": true,
  "message": "Product transients cleared",
  "_links": {
    "self": [
      {
        "href": "https://example.com/wp-json/wc/v2/system_status/tools/clear_transients"
      }
    ],
    "collection": [
      {
        "href": "https://example.com/wp-json/wc/v2/system_status/tools"
      }
    ]
  }
}
</TabItem> </Tabs>