67% add-fields-to-checkout-page-woocommerce

Code Review | Custom WooCommerce Checkout Fields Editor

WordPress plugin Custom WooCommerce Checkout Fields Editor scored 67% from 54 tests.

About plugin

  • Plugin page: add-fields-to-che...
  • Plugin version: 1.2.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.0-5.6.0
  • WordPress version: 5.9.2
  • First release: Mar 27, 2017
  • Latest release: Mar 10, 2021
  • Number of updates: 203
  • Update frequency: every 7.1 days
  • Top authors: themelocation (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

5,000+ active / 49,034 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.42MB] [CPU: ▼296.18ms] Passed 4 tests

Analyzing server-side resources used by Custom WooCommerce Checkout Fields Editor
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.3955.50 ▲3.43
Dashboard /wp-admin3.91 ▲0.5036.99 ▲2.08
Posts /wp-admin/edit.php4.13 ▲0.4939.21 ▲1.84
Add New Post /wp-admin/post-new.php7.37 ▲0.4095.98 ▼1,190.76
Media Library /wp-admin/upload.php3.70 ▲0.4026.33 ▲2.11
Freemius Debug [v.2.4.1] /wp-admin/admin.php?page=freemius4.0325.77

Server storage [IO: ▲3.61MB] [DB: ▲0.00MB] Passed 3 tests

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 192 new files
Database: no new tables, 4 new options
New WordPress options
fs_gdpr
fs_accounts
fs_debug_mode
fs_active_plugins

Browser metrics Passed 4 tests

A check of browser resources used by Custom WooCommerce Checkout Fields Editor
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,794 ▲7215.70 ▲0.026.42 ▲0.272.04 ▼0.63
Dashboard /wp-admin2,919 ▲586.16 ▼0.06116.73 ▼12.92172.04 ▲12.72
Posts /wp-admin/edit.php2,716 ▲223.23 ▼0.0062.92 ▼5.36153.15 ▲9.57
Add New Post /wp-admin/post-new.php1,669 ▲816.21 ▲0.70423.06 ▲5.79154.73 ▼0.37
Media Library /wp-admin/upload.php1,728 ▲305.67 ▲0.16144.47 ▲2.45198.33 ▲17.13
Freemius Debug [v.2.4.1] /wp-admin/admin.php?page=freemius1,4322.4554.41113.08

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/includes/class-freemius.php+8540
    Undefined property: stdClass::$plugins
  • This plugin did not uninstall successfully, leaving 4 options in the database
    • fs_gdpr
    • fs_accounts
    • fs_active_plugins
    • fs_debug_mode

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)
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/ajax-loader.php
  • 8× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function freemius() in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/partials/network-activation.php:6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php on line 6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php on line 8
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php on line 7
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_slug() on null in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php:9
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php on line 7
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/add-fields-to-checkout-page-woocommerce/freemius/templates/account/partials/addon.php on line 8

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Dashboard page for settings), #2 (Dashboard page for add new custom field), #3 (Thats how on front end your fields will look.)
The official readme.txt is a good inspiration

add-fields-to-checkout-page-woocommerce/checkout-form-editor.php 77% from 13 tests

"Custom WooCommerce Checkout Fields Editor" version 1.2.5's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("add-fields-to-checkout-page-woocommerce.php" instead of "checkout-form-editor.php")
  • Requires at least: The required version number must match the one declared in readme.txt ("4.5" instead of "3.0.0")
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected32,966 lines of code in 134 files:
LanguageFilesBlank linesComment linesLines of code
PHP1117,50516,21131,539
JavaScript616464605
PO File3132210353
CSS12233228
Markdown1680214
JSON10027

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Please tend to the following items
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,895)
Cyclomatic complexity
Average complexity per logical line of code0.63
Average class complexity89.17
▷ Minimum class complexity1.00
▷ Maximum class complexity2,895.00
Average method complexity4.67
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes47
▷ Abstract classes24.26%
▷ Concrete classes4595.74%
▷ Final classes00.00%
Methods1,162
▷ Static methods17615.15%
▷ Public methods81970.48%
▷ Protected methods151.29%
▷ Private methods32828.23%
Functions116
▷ Named functions116100.00%
▷ Anonymous functions00.00%
Constants126
▷ Global constants10180.16%
▷ Class constants2519.84%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
11 PNG files occupy 0.33MB with 0.20MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/add-fields-to-checkout-page-woocommerce.png14.05KB7.38KB▼ 47.45%
assets/js/ajax-done.png3.73KB1.84KB▼ 50.60%
assets/css/tick.png3.05KB0.27KB▼ 91.20%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
assets/css/upgrade-btn.png7.61KB2.20KB▼ 71.09%