10% min-and-max-purchase-for-woocommerce

Code Review | Min and Max Purchase for WooCommerce

WordPress plugin Min and Max Purchase for WooCommerce scored 10% from 54 tests.

About plugin

  • Plugin page: min-and-max-purch...
  • Plugin version: 2.0.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0.0-6.0.2
  • WordPress version: 6.3.1
  • First release: Jan 19, 2013
  • Latest release: Oct 12, 2022
  • Number of updates: 158
  • Update frequency: every 23.0 days
  • Top authors: vark (100%)

Code review

54 tests

User reviews

25 reviews

Install metrics

1,000+ active / 40,058 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The following installer errors require your attention
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/min-and-max-purchase-for-woocommerce/woo-integration/vtmam-parent-definitions.php+132
    Undefined variable: timeout

Server metrics [RAM: ▲0.00MB] [CPU: ▼6.48ms] Passed 4 tests

Analyzing server-side resources used by Min and Max Purchase for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.75 ▼2.36
Dashboard /wp-admin3.31 ▲0.0046.04 ▼3.98
Posts /wp-admin/edit.php3.36 ▲0.0051.26 ▲9.35
Add New Post /wp-admin/post-new.php5.89 ▲0.0086.84 ▼15.55
Media Library /wp-admin/upload.php3.23 ▲0.0031.64 ▼4.02

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 37 new files
Database: no new tables, 7 new options
New WordPress options
vtmam_ip_address
db_upgraded
can_compress_scripts
widget_recent-comments
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Min and Max Purchase 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,800 ▲6513.20 ▼1.391.82 ▲0.0945.13 ▼1.28
Dashboard /wp-admin2,206 ▲155.90 ▲1.0094.67 ▼10.1438.17 ▼4.01
Posts /wp-admin/edit.php2,089 ▲212.02 ▲0.0339.41 ▲4.8335.00 ▼1.84
Add New Post /wp-admin/post-new.php1,514 ▼517.75 ▼5.38679.38 ▲7.1352.04 ▼14.94
Media Library /wp-admin/upload.php1,388 ▲34.19 ▼0.0293.30 ▼9.2543.19 ▼3.63

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • vtmam_ip_address
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% 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)
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/min-and-max-purchase-for-woocommerce/woo-integration/vtmam-parent-cart-validation.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/min-and-max-purchase-for-woocommerce/admin/vtmam-license-options.php:42
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/min-and-max-purchase-for-woocommerce/vt-minandmax-purchase.php:39
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/min-and-max-purchase-for-woocommerce/admin/vtmam-setup-options.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/min-and-max-purchase-for-woocommerce/woo-integration/vtmam-parent-definitions.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _x() in wp-content/plugins/min-and-max-purchase-for-woocommerce/core/vtmam-backbone.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/min-and-max-purchase-for-woocommerce/woo-integration/vtmam-parent-functions.php:866

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention:
  • Screenshots: These screenshots do not have images: #1 (Min and Max Purchase Rule Screen), #2 (Group Search Criteria), #3 (Rule application method - Any), #4 (Rule application method - Each), #5 (Rule application method - All), #6 (Quantity or Price Min and Max Amount), #7 (Error Message at Checkout)
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

min-and-max-purchase-for-woocommerce/vt-minandmax-purchase.php 85% from 13 tests

The primary PHP file in "Min and Max Purchase for WooCommerce" version 2.0.0 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("min-and-max-purchase-for-woocommerce.php" instead of "vt-minandmax-purchase.php")
  • Requires at least: The required version number must match the one declared in readme.txt ("3.3" instead of "2.0.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin7,844 lines of code in 22 files:
LanguageFilesBlank linesComment linesLines of code
PHP161,9132,8056,479
CSS3671541,140
JavaScript23753221
INI1004

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity42.28
▷ Minimum class complexity1.00
▷ Maximum class complexity196.00
Average method complexity5.35
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes18
▷ Abstract classes00.00%
▷ Concrete classes18100.00%
▷ Final classes00.00%
Methods171
▷ Static methods00.00%
▷ Public methods16998.83%
▷ Protected methods00.00%
▷ Private methods21.17%
Functions33
▷ Named functions33100.00%
▷ Anonymous functions00.00%
Constants30
▷ Global constants30100.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