10% woocommerce

Code Review | WooCommerce

WordPress plugin WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: woocommerce
  • Plugin version: 8.3.1
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.3-6.4
  • WordPress version: 6.3.1
  • First release: Sep 27, 2011
  • Latest release: Nov 23, 2023
  • Number of updates: 748
  • Update frequency: every 6.0 days
  • Top authors: claudiosanches (23.4%)woothemes (22.33%)mikejolley (11.1%)sadowski (11.1%)royho (4.41%)

Code review

54 tests

User reviews

4168 reviews

Install metrics

5,000,000+ active /282,316,497 total downloads

Benchmarks

Plugin footprint 38% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
It is recommended to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > User notice in wp-includes/functions.php+5905
    Function FeaturesController::get_compatible_plugins_for_feature was called incorrectly. FeaturesController::get_compatible_plugins_for_feature should not be called before the woocommerce_init action. Backtrace: Potrivit_Wp_Api->run, Potrivit_Wp_Api->_executeMethod, Potrivit_Wp_Api->pluginActivate, activate_plugin, do_action('activate_woocommerce/woocommerce.php'), WP_Hook->do_action, WP_Hook->apply_filters, WC_Install::install, WC_Install::create_options, WC_Settings_Page->get_settings, WC_Settings_Page->get_settings_for_section, apply_filters('woocommerce_get_settings_advanced'), WP_Hook->apply_filters, Automattic\WooCommerce\Internal\Features\FeaturesController->__call, call_user_func_array, Automattic\WooCommerce\Internal\Features\FeaturesController->add_feature_settings, array_map, Automattic\WooCommerce\Internal\Features\FeaturesController->Automattic\WooCommerce\Internal\Features\{closure}, call_user_func, Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController->Automattic\WooCommerce\Internal\DataStores\Orders\{closure}, Automattic\WooCommerce\Internal\Features\FeaturesController->get_compatible_plugins_for_feature, Automattic\WooCommerce\Internal\Features\FeaturesController->verify_did_woocommerce_init, Automattic\WooCommerce\Proxies\LegacyProxy->call_function, call_user_func_array, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 7.0.)

Server metrics [RAM: ▲27.89MB] [CPU: ▲350.68ms] 0% 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 48.18MB on /wp-admin/admin.php?page=wc-addons)
  • CPU: Total CPU usage should be kept under 500.00ms (currently 605.08ms on /wp-admin/admin.php?page=wc-addons)
  • Extra RAM: Extra memory usage should kept under 5MB (currently 27.89MB on /wp-admin/admin.php?page=wc-addons)
  • Extra CPU: Extra CPU usage must be kept under 200.00ms (currently 350.68ms on /wp-admin/admin.php?page=wc-addons)
PageMemory (MB)CPU Time (ms)
Home /30.23 ▲26.77264.05 ▲222.53
Dashboard /wp-admin31.67 ▲28.37526.64 ▲480.14
Posts /wp-admin/edit.php31.61 ▲28.25313.65 ▲268.45
Add New Post /wp-admin/post-new.php50.63 ▲44.75780.03 ▲688.80
Media Library /wp-admin/upload.php31.40 ▲28.17465.80 ▲431.60
Tags /wp-admin/edit-tags.php?taxonomy=product_tag&post_type=product48.30707.14
Revenue /wp-admin/admin.php?page=wc-admin&path=/analytics/revenue51.30644.08
Home 6 /wp-admin/admin.php?page=wc-admin30.44242.49
Extensions /wp-admin/admin.php?page=wc-admin&path=/extensions51.17469.01
Coupons /wp-admin/edit.php?post_type=shop_coupon48.28406.72
Product Export /wp-admin/edit.php?post_type=product&page=product_exporter48.19430.40
Settings /wp-admin/admin.php?page=wc-admin&path=/analytics/settings51.17430.42
Customers /wp-admin/admin.php?page=wc-admin&path=/customers51.17453.46
Variations /wp-admin/admin.php?page=wc-admin&path=/analytics/variations51.17469.50
/wp-admin/admin.php?page=wc-addons48.18605.08

Server storage [IO: ▲45.82MB] [DB: ▲0.79MB] 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 45.82MB)
Filesystem: 5,730 new files
Database: 38 new tables, 113 new options
New tables
wp_woocommerce_payment_tokenmeta
wp_wc_admin_note_actions
wp_woocommerce_shipping_zone_methods
wp_wc_product_meta_lookup
wp_wc_order_addresses
wp_woocommerce_attribute_taxonomies
wp_woocommerce_sessions
wp_wc_order_coupon_lookup
wp_wc_product_attributes_lookup
wp_woocommerce_log
...
New WordPress options
woocommerce_db_version
woocommerce_myaccount_view_order_endpoint
woocommerce_thumbnail_image_width
woocommerce_placeholder_image
woocommerce_myaccount_orders_endpoint
woocommerce_myaccount_add_payment_method_endpoint
woocommerce_specific_allowed_countries
woocommerce_cart_redirect_after_add
woocommerce_unforce_ssl_checkout
woocommerce_price_display_suffix
...

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,251 ▲48913.70 ▼0.8712.67 ▲10.9637.64 ▼5.02
Dashboard /wp-admin2,534 ▲3564.87 ▼0.82102.09 ▼14.7478.20 ▲30.71
Posts /wp-admin/edit.php2,346 ▲2462.10 ▲0.1250.84 ▲8.2537.22 ▲1.88
Add New Post /wp-admin/post-new.php2,038 ▲51230.58 ▲7.221,086.62 ▲433.9737.59 ▼10.68
Media Library /wp-admin/upload.php1,680 ▲2804.29 ▲0.12140.56 ▲43.8651.22 ▲9.32
Tags /wp-admin/edit-tags.php?taxonomy=product_tag&post_type=product1,98018.73481.5428.27
Revenue /wp-admin/admin.php?page=wc-admin&path=/analytics/revenue3,74922.57546.75140.12
Home 6 /wp-admin/admin.php?page=wc-admin1,17319.32332.7837.52
Extensions /wp-admin/admin.php?page=wc-admin&path=/extensions2,48822.03310.3695.06
Coupons /wp-admin/edit.php?post_type=shop_coupon2,06922.91364.8649.80
Product Export /wp-admin/edit.php?post_type=product&page=product_exporter1,58514.90265.3135.63
Settings /wp-admin/admin.php?page=wc-admin&path=/analytics/settings1,29416.11363.90179.77
Customers /wp-admin/admin.php?page=wc-admin&path=/customers2,22520.73360.4459.76
Variations /wp-admin/admin.php?page=wc-admin&path=/analytics/variations1,44816.93421.6293.61
/wp-admin/admin.php?page=wc-addons3,98521.03279.6778.64

Uninstaller [IO: ▲0.32MB] [DB: ▲0.79MB] 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 38 tables in the database
    • wp_actionscheduler_groups
    • wp_woocommerce_downloadable_product_permissions
    • wp_wc_product_attributes_lookup
    • wp_woocommerce_order_itemmeta
    • wp_wc_product_download_directories
    • wp_woocommerce_payment_tokens
    • wp_wc_order_product_lookup
    • wp_wc_category_lookup
    • wp_wc_orders_meta
    • wp_woocommerce_shipping_zone_locations
    • ...
  • The uninstall procedure has failed, leaving 114 options in the database
    • wc_blocks_version
    • woocommerce_permalinks
    • woocommerce_tax_display_shop
    • widget_recent-comments
    • widget_woocommerce_widget_cart
    • woocommerce_default_country
    • woocommerce_enable_review_rating
    • woocommerce_default_customer_address
    • woocommerce_db_version
    • woocommerce_maxmind_geolocation_settings
    • ...

Smoke tests 25% 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 0% 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
  • 14× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-hero.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-collection-full-grid.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-query-minimal-product-list.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-collection-grid.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-collection-rows.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-query-product-list-with-1-1-images.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-details-listing.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/header-minimal.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/product-collection-simple-grid.php
    • > /wp-content/plugins/woocommerce/packages/woocommerce-blocks/patterns/header-centered-search-pattern.php
  • 776× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\ode\\AbstractNode' not found in wp-content/plugins/woocommerce/vendor/symfony/css-selector/Node/ClassNode.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\Blocks\\BlockTypes\\AbstractBlock' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/MiniCartContents.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\CssSelector\\XPath\\Extension\\AbstractExtension' not found in wp-content/plugins/woocommerce/vendor/symfony/css-selector/XPath/Extension/NodeExtension.php:28
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\StoreApi\\Schemas\\V1\\AbstractAddressSchema' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/StoreApi/Schemas/V1/BillingAddressSchema.php:12
    • > 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/vendor/composer/installers/src/Composer/Installers/ExpressionEngineInstaller.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\Admin\\Features\\OnboardingTasks\\Task' not found in wp-content/plugins/woocommerce/src/Admin/Features/OnboardingTasks/Tasks/Payments.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Automattic\\WooCommerce\\Blocks\\BlockTypes\\AbstractInnerBlock' not found in wp-content/plugins/woocommerce/packages/woocommerce-blocks/src/BlockTypes/CartOrderSummaryHeadingBlock.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Automattic\\WooCommerce\\Vendor\\League\\Container\\Definition\\DefinitionAggregateInterface' not found in wp-content/plugins/woocommerce/lib/packages/League/Container/Definition/DefinitionAggregate.php:9
    • > PHP Fatal error
      Uncaught Error: Interface 'Automattic\\WooCommerce\\Caching\\CacheEngine' not found in wp-content/plugins/woocommerce/src/Caching/WPCacheEngine.php:8

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
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wc-admin&path=/analytics/variations
    • > Console-api (warning) in wp-includes/js/dist/deprecated.min.js?ver=73ad3591e7bc95f4777a+1:627
    `position` prop in wp.components.Dropdown is deprecated since version 6.2. Please use `popoverProps.placement` prop instead. Note: Note that the `position` prop will override any values passed through the `popoverProps.placement` prop.

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 (12 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 8.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
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/woocommerce/vendor/bin/wp.bat
460,219 lines of code in 5,041 files:
LanguageFilesBlank linesComment linesLines of code
PHP2,29352,973134,668268,434
TypeScript1,1776,87810,94169,343
JavaScript74610,8357,69754,145
Sass2366,32132432,119
CSS2737853,98713,791
XML35189,061
JSON178008,801
SVG99222,110
JSX121911871,534
C111825668
HTML178425098
m418032
DOS Batch17030
Bourne Shell17426
diff122517
C/C++ Header14128
YAML1002

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 106)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity16.60
▷ Minimum class complexity1.00
▷ Maximum class complexity469.00
Average method complexity3.23
▷ Minimum method complexity1.00
▷ Maximum method complexity106.00
Code structure
Namespaces158
Interfaces75
Traits20
Classes1,787
▷ Abstract classes965.37%
▷ Concrete classes1,69194.63%
▷ Final classes301.77%
Methods13,298
▷ Static methods2,31717.42%
▷ Public methods9,67472.75%
▷ Protected methods2,30217.31%
▷ Private methods1,3229.94%
Functions1,336
▷ Named functions93569.99%
▷ Anonymous functions40130.01%
Constants743
▷ Global constants405.38%
▷ Class constants70394.62%
▷ Public constants66494.45%

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
139 PNG files occupy 7.43MB with 1.65MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/marketing/vimeo.png2.48KB1.21KB▼ 51.40%
assets/css/jquery-ui/images/ui-icons_2e83ff_256x240.png3.69KB4.18KB0.00%
assets/images/admin_notes/marketing-jetpack-2x.png18.90KB7.56KB▼ 60.01%
assets/images/task_list/tax-illustration.png11.08KB11.65KB0.00%
assets/images/icons/credit-cards/amex.png1.69KB1.71KB0.00%