56% woocommerce

Code Review | WooCommerce

WordPress plugin WooCommerce scored 56% from 54 tests.

About plugin

  • Plugin page: woocommerce
  • Plugin version: 6.3.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.7-5.9
  • WordPress version: 5.9.2
  • First release: Sep 27, 2011
  • Latest release: Mar 14, 2022
  • Number of updates: 603
  • Update frequency: every 6.4 days
  • Top authors: claudiosanches (28.69%)woothemes (27.69%)mikejolley (13.76%)peterfabian1000 (4.15%)sadowski (3.98%)

Code review

54 tests

User reviews

3846 reviews

Install metrics

5,000,000+ active / 182,062,371 total downloads

Benchmarks

Plugin footprint 63% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲19.80MB] [CPU: ▼158.78ms] 25% from 4 tests

A check of server-side resources used by WooCommerce
Please take the time to fix the following items
  • RAM: Try to keep total memory usage under 10MB (currently 45.52MB on /wp-admin/admin.php?page=wc-admin&path=/customers)
  • CPU: Total CPU usage should be kept under 500.00ms (currently 1,305.36ms on /wp-admin/admin.php?page=wc-addons)
  • Extra RAM: Extra memory usage should kept under 5MB (currently 19.80MB on /wp-admin/admin.php?page=wc-admin&path=/customers)
PageMemory (MB)CPU Time (ms)
Home /22.33 ▲18.81183.03 ▲127.94
Dashboard /wp-admin24.16 ▲20.76154.19 ▲116.13
Posts /wp-admin/edit.php23.45 ▲19.81159.09 ▲113.33
Add New Post /wp-admin/post-new.php47.17 ▲40.17328.88 ▼992.52
Media Library /wp-admin/upload.php23.11 ▲19.81251.58 ▲226.50
Taxes /wp-admin/admin.php?page=wc-admin&path=/analytics/taxes45.52721.93
Setup Wizard /wp-admin/admin.php?page=wc-admin&path=/setup-wizard45.52246.46
Extensions /wp-admin/admin.php?page=wc-addons42.221,305.36
Scheduled Actions /wp-admin/tools.php?page=action-scheduler23.23138.90
Categories /wp-admin/admin.php?page=wc-admin&path=/analytics/categories45.52237.93
Settings /wp-admin/admin.php?page=wc-admin&path=/analytics/settings45.52233.16
Products /wp-admin/admin.php?page=wc-admin&path=/analytics/products45.52294.96
Coupons /wp-admin/edit.php?post_type=shop_coupon42.14222.15
Downloads /wp-admin/admin.php?page=wc-admin&path=/analytics/downloads45.52233.38
Customers /wp-admin/admin.php?page=wc-admin&path=/customers45.52232.81

Server storage [IO: ▲28.51MB] [DB: ▲0.56MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
Just a few items left to fix
  • Try to limit filesystem usage to 25MB (currently using 28.51MB)
Filesystem: 3,800 new files
Database: 33 new tables, 100 new options
New tables
wp_actionscheduler_claims
wp_wc_product_meta_lookup
wp_wc_customer_lookup
wp_wc_webhooks
wp_woocommerce_shipping_zone_locations
wp_woocommerce_downloadable_product_permissions
wp_wc_product_attributes_lookup
wp_woocommerce_order_items
wp_woocommerce_payment_tokens
wp_woocommerce_payment_tokenmeta
...
New WordPress options
wc_blocks_db_schema_version
woocommerce_api_enabled
woocommerce_meta_box_errors
woocommerce_shipping_cost_requires_address
woocommerce_task_list_completed_lists
woocommerce_all_except_countries
widget_woocommerce_products
woocommerce_shop_page_id
woocommerce_price_thousand_sep
schema-ActionScheduler_StoreSchema
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,488 ▼23416.39 ▲0.7549.73 ▲43.602.75 ▲0.38
Dashboard /wp-admin2,386 ▼4696.18 ▲0.0494.64 ▼37.86186.52 ▲25.58
Posts /wp-admin/edit.php2,247 ▼4472.89 ▼0.3437.96 ▼30.28135.77 ▼7.07
Add New Post /wp-admin/post-new.php2,036 ▲37520.05 ▲3.39589.29 ▲169.52150.51 ▼1.47
Media Library /wp-admin/upload.php1,630 ▼685.60 ▲0.07100.01 ▼41.53191.87 ▲5.17
Taxes /wp-admin/admin.php?page=wc-admin&path=/analytics/taxes2,86218.26473.01217.60
Setup Wizard /wp-admin/admin.php?page=wc-admin&path=/setup-wizard1,66418.82254.12134.49
Extensions /wp-admin/admin.php?page=wc-addons2,80514.81164.25202.07
Scheduled Actions /wp-admin/tools.php?page=action-scheduler1,3972.5032.10109.62
Categories /wp-admin/admin.php?page=wc-admin&path=/analytics/categories2,71221.72270.50213.07
Settings /wp-admin/admin.php?page=wc-admin&path=/analytics/settings1,72317.02192.75199.17
Products /wp-admin/admin.php?page=wc-admin&path=/analytics/products2,95522.92341.36222.99
Coupons /wp-admin/edit.php?post_type=shop_coupon2,05515.50207.73195.58
Downloads /wp-admin/admin.php?page=wc-admin&path=/analytics/downloads2,55120.10263.53221.86
Customers /wp-admin/admin.php?page=wc-admin&path=/customers2,76219.02247.20179.62

Uninstaller [IO: ▲0.32MB] [DB: ▲0.56MB] 50% from 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The plugin did not uninstall successfully, leaving 33 tables in the database
    • wp_wc_order_product_lookup
    • wp_woocommerce_sessions
    • wp_actionscheduler_logs
    • wp_actionscheduler_actions
    • wp_woocommerce_payment_tokenmeta
    • wp_woocommerce_api_keys
    • wp_wc_rate_limits
    • wp_wc_reserved_stock
    • wp_actionscheduler_groups
    • wp_wc_order_stats
    • ...
  • The uninstall procedure has failed, leaving 101 options in the database
    • widget_woocommerce_layered_nav_filters
    • woocommerce_version
    • woocommerce_tax_display_shop
    • woocommerce_enable_review_rating
    • woocommerce_api_enabled
    • woocommerce_attribute_lookup_enabled
    • woocommerce_myaccount_delete_payment_method_endpoint
    • woocommerce_store_address
    • woocommerce_hide_out_of_stock_items
    • woocommerce_placeholder_image
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 578× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\\Tests\ode\\AbstractNodeTest' not found in wp-content/plugins/woocommerce/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/woocommerce/packages/woocommerce-admin/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\\Exception\\ParseException' not found in wp-content/plugins/woocommerce/vendor/symfony/css-selector/Exception/InternalErrorException.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/vendor/composer/installers/src/Composer/Installers/MODXEvoInstaller.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/vendor/composer/installers/src/Composer/Installers/KodiCMSInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/vendor/composer/installers/src/Composer/Installers/WolfCMSInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installer\\LibraryInstaller' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/vendor/composer/installers/src/Composer/Installers/Installer.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/woocommerce/vendor/composer/installers/src/Composer/Installers/LaravelInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/vendor/composer/installers/src/Composer/Installers/GravInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'ActionScheduler_Abstract_QueueRunner' not found in wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_QueueRunner.php:6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please take a look at the following user-side issues
  • 9 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wc-admin&path=/customers
    • > Console-api (warning) in wp-includes/js/dist/deprecated.min.js?ver=8778985ac0dfb16f24f8ef86d0718f43+1:1537
    wp.compose.withState is deprecated. Please use wp.element.useState instead.
    • > GET request to /wp-admin/admin.php?page=wc-addons
    • > Javascript (severe) in unknown
    /wp-content/plugins/woocommerce/packages/woocommerce-admin/dist/app/index.js?ver=3.2.1 1:120297 Uncaught DOMException: Failed to execute 'insertBefore' on 'Node': The no…de is to be inserted is not a child of this node.

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Please fix the following attributes:
  • Screenshots: These screenshots need descriptions #1, #2, #3, #4, #5, #6 in woocommerce/assets to your readme.txt
  • Tags: Too many tags (15 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

woocommerce/woocommerce.php Passed 13 tests

Analyzing the main PHP file in "WooCommerce" version 6.3.1
63 characters long description:
An eCommerce toolkit that helps you sell anything. Beautifully.

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Please make sure to remedy the following
  • Do not include executable or dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/woocommerce/vendor/bin/wp.bat
339,918 lines of code in 3,287 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,68741,551101,691211,889
JavaScript76712,06611,79168,683
Sass1735,80517227,646
TypeScript4452,2674,57822,731
XML21184,846
JSON31001,888
CSS11197106627
C19718589
SVG5801524
HTML7236382
m418032
DOS Batch17030
Bourne Shell17426
diff122517
C/C++ Header14128

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 105)
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity15.24
▷ Minimum class complexity1.00
▷ Maximum class complexity469.00
Average method complexity3.22
▷ Minimum method complexity1.00
▷ Maximum method complexity105.00
Code structure
Namespaces109
Interfaces57
Traits13
Classes1,511
▷ Abstract classes775.10%
▷ Concrete classes1,43494.90%
▷ Final classes201.39%
Methods10,340
▷ Static methods1,77717.19%
▷ Public methods7,66374.11%
▷ Protected methods1,86918.08%
▷ Private methods8087.81%
Functions1,118
▷ Named functions91581.84%
▷ Anonymous functions20318.16%
Constants478
▷ Global constants326.69%
▷ Class constants44693.31%
▷ Public constants446100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
70 PNG files occupy 0.67MB with 0.14MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/css/jquery-ui/images/ui-icons_cd0a0a_256x240.png3.69KB4.18KB0.00%
packages/woocommerce-admin/images/onboarding/eway.png8.77KB4.31KB▼ 50.82%
assets/images/mercadopago.png6.35KB3.17KB▼ 50.05%
packages/woocommerce-admin/images/onboarding/g-shopping.png1.29KB1.34KB0.00%
packages/woocommerce-admin/images/onboarding/paystack.png2.08KB2.23KB0.00%