72% maximum-purchase-for-woocommerce

Code Review | Maximum Purchase for WooCommerce

WordPress plugin Maximum Purchase for WooCommerce scored72%from 54 tests.

About plugin

  • Plugin page: maximum-purchase-...
  • Plugin version: 1.07.7.6
  • PHP version: 7.4.16
  • WordPress compatibility: 2.0.0-5.9
  • WordPress version: 6.3.1
  • First release: Jan 19, 2013
  • Latest release: Aug 23, 2021
  • Number of updates: 135
  • Update frequency: every 23.9 days
  • Top authors: vark (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

80+ active /9,418 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
Installer ran successfully

Server metrics [RAM: ▼0.10MB] [CPU: ▼5.49ms] Passed 4 tests

Server-side resources used by Maximum Purchase for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.79 ▼0.6717.55 ▼26.49
Dashboard /wp-admin3.39 ▲0.0951.29 ▲3.06
Posts /wp-admin/edit.php3.44 ▲0.0954.34 ▲0.62
Add New Post /wp-admin/post-new.php5.98 ▲0.09102.84 ▲0.85
Media Library /wp-admin/upload.php3.32 ▲0.1049.57 ▲15.11
Upgrade to Pro /wp-admin/edit.php?post_type=vtmax-rule&page=vtmax_pro_upgrade3.2938.57
Maximum Purchase Categories /wp-admin/edit-tags.php?taxonomy=vtmax_rule_category&post_type=product3.3036.64
Maximum Purchase Rules /wp-admin/edit.php?post_type=vtmax-rule3.3738.07
Rules Options Settings /wp-admin/edit.php?post_type=vtmax-rule&page=vtmax_setup_options_page3.2737.82
Add New /wp-admin/post-new.php?post_type=vtmax-rule3.3140.15

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 31 new files
Database: no new tables, 8 new options
New WordPress options
db_upgraded
theysaidso_admin_options
vtmax_setup_options
widget_recent-comments
vtmax_rule_category_children
can_compress_scripts
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Maximum Purchase for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,921 ▲17514.02 ▼0.387.95 ▲6.1743.33 ▼1.89
Dashboard /wp-admin2,242 ▲515.81 ▲0.9497.03 ▼6.6338.76 ▲0.37
Posts /wp-admin/edit.php2,131 ▲422.06 ▲0.0440.69 ▼6.3035.07 ▼1.29
Add New Post /wp-admin/post-new.php1,565 ▲3223.41 ▲0.24647.51 ▲23.2756.81 ▼5.44
Media Library /wp-admin/upload.php1,430 ▲424.24 ▼0.01101.98 ▼2.7443.14 ▼2.21
Upgrade to Pro /wp-admin/edit.php?post_type=vtmax-rule&page=vtmax_pro_upgrade8542.0222.6239.63
Maximum Purchase Categories /wp-admin/edit-tags.php?taxonomy=vtmax_rule_category&post_type=product1,4052.1427.5532.86
Maximum Purchase Rules /wp-admin/edit.php?post_type=vtmax-rule1,1011.9733.0831.36
Rules Options Settings /wp-admin/edit.php?post_type=vtmax-rule&page=vtmax_setup_options_page1,3362.1223.8352.84
Add New /wp-admin/post-new.php?post_type=vtmax-rule2,3373.0279.26134.84

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • Zombie WordPress options detected upon uninstall: 8 options
    • vtmax_rule_category_children
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • vtmax_setup_options
    • widget_recent-posts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
    • > GET request to /wp-admin/edit-tags.php?taxonomy=vtmax_rule_category&post_type=product
    • > Notice in wp-admin/includes/class-wp-terms-list-table.php+584
    Trying to get property 'show_ui' of non-object
    • > GET request to /wp-admin/edit.php?post_type=vtmax-rule&page=vtmax_setup_options_page
    • > Warning in wp-content/plugins/maximum-purchase-for-woocommerce/admin/vtmax-setup-options.php+111
    Use of undefined constant VTMAX_DOCUMENTATION_PATH - assumed 'VTMAX_DOCUMENTATION_PATH' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/edit.php?post_type=vtmax-rule&page=vtmax_setup_options_page
    • > Notice in wp-content/plugins/maximum-purchase-for-woocommerce/core/vtmax-backbone.php+128
    Undefined offset: 1
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Warning in wp-content/plugins/maximum-purchase-for-woocommerce/admin/vtmax-rules-ui.php+72
    sizeof(): Parameter must be an array or an object that implements Countable
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-content/plugins/maximum-purchase-for-woocommerce/admin/vtmax-rules-ui.php+74
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-content/plugins/maximum-purchase-for-woocommerce/admin/vtmax-rules-ui.php+74
    Trying to get property 'post_id' of non-object
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-content/plugins/maximum-purchase-for-woocommerce/woo-integration/vtmax-parent-functions.php+184
    Undefined variable: product_variations_list
  • 24 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-admin/includes/template.php+247
    Trying to get property 'term_id' of non-object
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Warning in wp-admin/includes/template.php+242
    in_array() expects parameter 2 to be array, object given
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-admin/includes/template.php+247
    Trying to get property 'cap' of non-object
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-admin/includes/template.php+247
    Trying to get property 'assign_terms' of non-object
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Notice in wp-admin/includes/template.php+250
    Trying to get property 'name' of non-object

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/maximum-purchase-for-woocommerce/vt-maximum-purchase.php:36
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/maximum-purchase-for-woocommerce/woo-integration/vtmax-parent-functions.php:375
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/maximum-purchase-for-woocommerce/admin/vtmax-setup-options.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/maximum-purchase-for-woocommerce/woo-integration/vtmax-parent-definitions.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/maximum-purchase-for-woocommerce/woo-integration/vtmax-parent-cart-validation.php:21
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _x() in wp-content/plugins/maximum-purchase-for-woocommerce/core/vtmax-backbone.php:16

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There are user-side issues you should fix
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtmax-rule
    • > Network (severe)
    wp-content/plugins/maximum-purchase-for-woocommerce/admin//admin/js/vtmax-variations-script.js?ver=6.3.1 - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 11 tag instead of maximum 10
  • Screenshots: These screenshots require images: #1 (Maximum 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 Maximum Amount), #7 (Error Message at Checkout)
You can take inspiration from this readme.txt

maximum-purchase-for-woocommerce/vt-maximum-purchase.php 85% from 13 tests

The main PHP file in "Maximum Purchase for WooCommerce" ver. 1.07.7.6 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("3.3" instead of "2.0.0")
  • Main file name: Name the main plugin file the same as the plugin slug ("maximum-purchase-for-woocommerce.php" instead of "vt-maximum-purchase.php")

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
There were no executable files found in this plugin4,289 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP138561,0573,499
CSS24487585
JavaScript23453205

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity23.60
▷ Minimum class complexity1.00
▷ Maximum class complexity137.00
Average method complexity3.78
▷ Minimum method complexity1.00
▷ Maximum method complexity56.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes15
▷ Abstract classes00.00%
▷ Concrete classes15100.00%
▷ Final classes00.00%
Methods122
▷ Static methods00.00%
▷ Public methods122100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants21
▷ Global constants21100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
PNG images were not found in this plugin