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)
Page Memory (MB) CPU Time (ms)
Home / 30.23 ▲26.77 264.05 ▲222.53
Dashboard /wp-admin 31.67 ▲28.37 526.64 ▲480.14
Posts /wp-admin/edit.php 31.61 ▲28.25 313.65 ▲268.45
Add New Post /wp-admin/post-new.php 50.63 ▲44.75 780.03 ▲688.80
Media Library /wp-admin/upload.php 31.40 ▲28.17 465.80 ▲431.60
Tags /wp-admin/edit-tags.php?taxonomy=product_tag&post_type=product 48.30 707.14
Revenue /wp-admin/admin.php?page=wc-admin&path=/analytics/revenue 51.30 644.08
Home 6 /wp-admin/admin.php?page=wc-admin 30.44 242.49
Extensions /wp-admin/admin.php?page=wc-admin&path=/extensions 51.17 469.01
Coupons /wp-admin/edit.php?post_type=shop_coupon 48.28 406.72
Product Export /wp-admin/edit.php?post_type=product&page=product_exporter 48.19 430.40
Settings /wp-admin/admin.php?page=wc-admin&path=/analytics/settings 51.17 430.42
Customers /wp-admin/admin.php?page=wc-admin&path=/customers 51.17 453.46
Variations /wp-admin/admin.php?page=wc-admin&path=/analytics/variations 51.17 469.50
/wp-admin/admin.php?page=wc-addons 48.18 605.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
Page Nodes Memory (MB) Script (ms) Layout (ms)
Home / 3,251 ▲489 13.70 ▼0.87 12.67 ▲10.96 37.64 ▼5.02
Dashboard /wp-admin 2,534 ▲356 4.87 ▼0.82 102.09 ▼14.74 78.20 ▲30.71
Posts /wp-admin/edit.php 2,346 ▲246 2.10 ▲0.12 50.84 ▲8.25 37.22 ▲1.88
Add New Post /wp-admin/post-new.php 2,038 ▲512 30.58 ▲7.22 1,086.62 ▲433.97 37.59 ▼10.68
Media Library /wp-admin/upload.php 1,680 ▲280 4.29 ▲0.12 140.56 ▲43.86 51.22 ▲9.32
Tags /wp-admin/edit-tags.php?taxonomy=product_tag&post_type=product 1,980 18.73 481.54 28.27
Revenue /wp-admin/admin.php?page=wc-admin&path=/analytics/revenue 3,749 22.57 546.75 140.12
Home 6 /wp-admin/admin.php?page=wc-admin 1,173 19.32 332.78 37.52
Extensions /wp-admin/admin.php?page=wc-admin&path=/extensions 2,488 22.03 310.36 95.06
Coupons /wp-admin/edit.php?post_type=shop_coupon 2,069 22.91 364.86 49.80
Product Export /wp-admin/edit.php?post_type=product&page=product_exporter 1,585 14.90 265.31 35.63
Settings /wp-admin/admin.php?page=wc-admin&path=/analytics/settings 1,294 16.11 363.90 179.77
Customers /wp-admin/admin.php?page=wc-admin&path=/customers 2,225 20.73 360.44 59.76
Variations /wp-admin/admin.php?page=wc-admin&path=/analytics/variations 1,448 16.93 421.62 93.61
/wp-admin/admin.php?page=wc-addons 3,985 21.03 279.67 78.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:
Language Files Blank lines Comment lines Lines of code
PHP 2,293 52,973 134,668 268,434
TypeScript 1,177 6,878 10,941 69,343
JavaScript 746 10,835 7,697 54,145
Sass 236 6,321 324 32,119
CSS 273 785 3,987 13,791
XML 3 5 18 9,061
JSON 178 0 0 8,801
SVG 99 2 2 2,110
JSX 12 191 187 1,534
C 1 118 25 668
HTML 17 84 250 98
m4 1 8 0 32
DOS Batch 1 7 0 30
Bourne Shell 1 7 4 26
diff 1 2 25 17
C/C++ Header 1 4 12 8
YAML 1 0 0 2

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 code 0.41
Average class complexity 16.60
▷ Minimum class complexity 1.00
▷ Maximum class complexity 469.00
Average method complexity 3.23
▷ Minimum method complexity 1.00
▷ Maximum method complexity 106.00
Code structure
Namespaces 158
Interfaces 75
Traits 20
Classes 1,787
▷ Abstract classes 96 5.37%
▷ Concrete classes 1,691 94.63%
▷ Final classes 30 1.77%
Methods 13,298
▷ Static methods 2,317 17.42%
▷ Public methods 9,674 72.75%
▷ Protected methods 2,302 17.31%
▷ Private methods 1,322 9.94%
Functions 1,336
▷ Named functions 935 69.99%
▷ Anonymous functions 401 30.01%
Constants 743
▷ Global constants 40 5.38%
▷ Class constants 703 94.62%
▷ Public constants 664 94.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
File Size - original Size - compressed Savings
assets/images/marketing/vimeo.png 2.48KB 1.21KB ▼ 51.40%
assets/css/jquery-ui/images/ui-icons_2e83ff_256x240.png 3.69KB 4.18KB 0.00%
assets/images/admin_notes/marketing-jetpack-2x.png 18.90KB 7.56KB ▼ 60.01%
assets/images/task_list/tax-illustration.png 11.08KB 11.65KB 0.00%
assets/images/icons/credit-cards/amex.png 1.69KB 1.71KB 0.00%