78% product-code-for-woocommerce

Code Review | Product Code for WooCommerce

WordPress plugin Product Code for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: product-code-for-...
  • Plugin version: 1.4.5
  • PHP compatiblity: 7.4.33+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6.0-6.4.1
  • WordPress version: 6.3.1
  • First release: Jan 27, 2019
  • Latest release: Dec 1, 2023
  • Number of updates: 75
  • Update frequency: every 23.8 days
  • Top authors: artiosmedia (100%)

Code review

54 tests

User reviews

24 reviews

Install metrics

1,000+ active /23,676 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▼0.01MB] [CPU: ▼4.47ms] Passed 4 tests

Analyzing server-side resources used by Product Code for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0037.66 ▲1.59
Dashboard /wp-admin3.31 ▼0.0448.55 ▼15.08
Posts /wp-admin/edit.php3.36 ▲0.0048.91 ▲3.28
Add New Post /wp-admin/post-new.php5.89 ▲0.0089.77 ▼5.01
Media Library /wp-admin/upload.php3.23 ▲0.0031.62 ▲0.64
Product Code /wp-admin/admin.php?page=wc_product_code3.0024.84

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 42 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
product_code_notice_dismiss
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-comments
product_code_text

Browser metrics Passed 4 tests

Checking browser requirements for Product Code for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲5414.27 ▼0.011.79 ▲0.2235.26 ▼3.75
Dashboard /wp-admin2,198 ▲275.60 ▼0.0793.70 ▼4.7442.16 ▼3.16
Posts /wp-admin/edit.php2,103 ▲31.98 ▲0.0143.00 ▼0.4235.08 ▼2.74
Add New Post /wp-admin/post-new.php1,526 ▼322.99 ▼0.12620.32 ▼36.8454.04 ▼6.89
Media Library /wp-admin/upload.php1,400 ▼34.15 ▲0.0096.34 ▼5.4443.93 ▼1.58
Product Code /wp-admin/admin.php?page=wc_product_code280.410.064.08

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 8 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • product_code_notice_dismiss
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • product_code_text

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% 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 fix the following items
  • 10× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/product-code-for-woocommerce/templates/link.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/product-code-for-woocommerce/modules/search/pcfw-product-code-search.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/product-code-for-woocommerce/templates/quick-edit-text-field.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_the_terms() in wp-content/plugins/product-code-for-woocommerce/templates/product-meta-row.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/product-code-for-woocommerce/modules/search/pcfw-searchwp-product-code-search.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/product-code-for-woocommerce/templates/hidden-product-list-column.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/product-code-for-woocommerce/modules/search/pcfw-relevanssi-product-code-search.php:3
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/product-code-for-woocommerce/templates/variation-field.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function woocommerce_wp_text_input() in wp-content/plugins/product-code-for-woocommerce/templates/wc-text-input.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Artiosmedia\\WC_Product_Code\\plugins_url() in wp-content/plugins/product-code-for-woocommerce/product-code-for-woocommerce.php:24

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=wc_product_code
    • > Network (severe)
    wp-admin/admin.php?page=wc_product_code - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
7 plugin tags: mpn, product code, warehouse tracking, product number, sku...

product-code-for-woocommerce/product-code-for-woocommerce.php 85% from 13 tests

The principal PHP file in "Product Code for WooCommerce" v. 1.4.5 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 184 characters long)
  • Requires at least: The required version number did not match the one declared in readme.txt ("4.6" instead of "4.6.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected2,405 lines of code in 33 files:
LanguageFilesBlank linesComment linesLines of code
PHP213943121,459
PO File5230266738
JavaScript45128161
CSS212046
JSON1001

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.45
Average class complexity29.83
▷ Minimum class complexity1.00
▷ Maximum class complexity63.00
Average method complexity3.44
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes6
▷ Abstract classes00.00%
▷ Concrete classes6100.00%
▷ Final classes00.00%
Methods73
▷ Static methods34.11%
▷ Public methods7298.63%
▷ Protected methods00.00%
▷ Private methods11.37%
Functions18
▷ Named functions844.44%
▷ Anonymous functions1055.56%
Constants8
▷ Global constants8100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
PNG images were not found in this plugin