78% advanced-product-fields-for-woocommerce

Code Review | Advanced Product Fields (Product Addons) for WooCommerce

WordPress plugin Advanced Product Fields (Product Addons) for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: advanced-product-...
  • Plugin version: 1.6.4
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6.0-6.4
  • WordPress version: 6.3.1
  • First release: Aug 7, 2019
  • Latest release: Oct 26, 2023
  • Number of updates: 82
  • Update frequency: every 18.8 days
  • Top authors: maartenbelmans (100%)

Code review

54 tests

User reviews

217 reviews

Install metrics

30,000+ active /568,971 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲0.17MB] [CPU: ▼3.20ms] Passed 4 tests

A check of server-side resources used by Advanced Product Fields (Product Addons) for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0738.32 ▼3.72
Dashboard /wp-admin3.51 ▲0.2045.69 ▲0.20
Posts /wp-admin/edit.php3.62 ▲0.2646.49 ▼1.16
Add New Post /wp-admin/post-new.php6.09 ▲0.2080.17 ▼3.01
Media Library /wp-admin/upload.php3.43 ▲0.2034.23 ▼4.92
Product Fields /wp-admin/admin.php?page=wapf-field-groups3.6138.09

Server storage [IO: ▲0.38MB] [DB: ▲0.49MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 80 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Advanced Product Fields (Product Addons) for WooCommerce: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,783 ▲2214.51 ▲0.221.62 ▲0.0838.08 ▼3.42
Dashboard /wp-admin2,192 ▲285.68 ▲0.0080.41 ▼24.1333.82 ▼7.96
Posts /wp-admin/edit.php2,094 ▼61.94 ▼0.0437.86 ▼2.2930.19 ▼5.61
Add New Post /wp-admin/post-new.php1,520 ▼823.59 ▲0.43720.39 ▲72.1971.11 ▲26.06
Media Library /wp-admin/upload.php1,397 ▼34.19 ▼0.0893.55 ▼12.3637.64 ▼8.73
Product Fields /wp-admin/admin.php?page=wapf-field-groups1,1793.7154.4541.24

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options

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 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
Almost there! Just fix the following items
  • 9× PHP files output text when accessed directly:
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/textarea.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/number.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/email.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/field-group.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/url.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/text.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/select.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/content.php
    • > /wp-content/plugins/advanced-product-fields-for-woocommerce/views/admin/field.php
  • 97× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Notice
      Undefined variable: model in wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/text.php on line 5
    • > PHP Notice
      Undefined variable: model in wp-content/plugins/advanced-product-fields-for-woocommerce/views/admin/settings/conditionals.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to a member function pricing_enabled() on null in wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/true-false.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/advanced-product-fields-for-woocommerce/views/admin/settings/number.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/advanced-product-fields-for-woocommerce/includes/classes/class-wapf-list-table.php:6
    • > PHP Notice
      Undefined variable: model in wp-content/plugins/advanced-product-fields-for-woocommerce/views/admin/settings/true-false.php on line 6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/advanced-product-fields-for-woocommerce/views/admin/settings/text.php on line 3
    • > PHP Notice
      Trying to get property 'id' of non-object in wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/field-group.php on line 19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/advanced-product-fields-for-woocommerce/views/admin/settings/url.php:5
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/advanced-product-fields-for-woocommerce/views/frontend/fields/true-false.php on line 9

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
5 plugin tags: woocommerce product options, woo product options, woocommerce custom fields, woocommerce product fields, woocommerce product addons

advanced-product-fields-for-woocommerce/advanced-product-fields-for-woocommerce.php 92% from 13 tests

The primary PHP file in "Advanced Product Fields (Product Addons) for WooCommerce" version 1.6.4 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("4.5" instead of "3.6.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected3,836 lines of code in 59 files:
LanguageFilesBlank linesComment linesLines of code
PHP541,113953,809
JavaScript20020
XML1005
CSS2002

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.49
Average class complexity21.90
▷ Minimum class complexity1.00
▷ Maximum class complexity72.00
Average method complexity3.15
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes21
▷ Abstract classes00.00%
▷ Concrete classes21100.00%
▷ Final classes00.00%
Methods161
▷ Static methods6842.24%
▷ Public methods14489.44%
▷ Protected methods00.00%
▷ Private methods1710.56%
Functions36
▷ Named functions411.11%
▷ Anonymous functions3288.89%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG images were found in this plugin