78% woo-wholesale-discount

Code Review | WooCommerce Wholesale Discount

WordPress plugin WooCommerce Wholesale Discount scored78%from 54 tests.

About plugin

  • Plugin page: woo-wholesale-dis...
  • Plugin version: 1.4
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.0.2
  • WordPress version: 6.3.1
  • First release: Mar 30, 2019
  • Latest release: Oct 14, 2022
  • Number of updates: 25
  • Update frequency: every 51.8 days
  • Top authors: minervainfotech (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /3,855 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
Install script ran successfully

Server metrics [RAM: ▲0.25MB] [CPU: ▲0.61ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce Wholesale Discount
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.71 ▲0.2540.89 ▼0.63
Dashboard /wp-admin3.55 ▲0.2559.97 ▲11.62
Posts /wp-admin/edit.php3.66 ▲0.3151.45 ▼1.63
Add New Post /wp-admin/post-new.php6.15 ▲0.26101.54 ▲4.10
Media Library /wp-admin/upload.php3.47 ▲0.2436.37 ▲0.61
Wholesale Discount /wp-admin/admin.php?page=wwsd-wholesale-discount3.4236.33

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 18 new files
Database: no new tables, 9 new options
New WordPress options
widget_recent-comments
wwsd_discount_type
widget_recent-posts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
can_compress_scripts
wwsd_woocommerce_wholesale_discount_curr_ver
recovery_mode_email_last_sent

Browser metrics Passed 4 tests

Checking browser requirements for WooCommerce Wholesale Discount
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,809 ▲4814.78 ▲0.431.70 ▼0.0544.21 ▼1.99
Dashboard /wp-admin2,213 ▲334.98 ▼0.72107.33 ▲1.3842.37 ▼2.27
Posts /wp-admin/edit.php2,118 ▲152.43 ▲0.4345.35 ▼0.5435.08 ▼5.02
Add New Post /wp-admin/post-new.php1,545 ▲1923.34 ▲0.18618.07 ▼73.2734.74 ▼37.14
Media Library /wp-admin/upload.php1,421 ▲244.57 ▲0.36101.88 ▼11.6045.04 ▲1.84
Wholesale Discount /wp-admin/admin.php?page=wwsd-wholesale-discount6981.5613.4516.71

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
  • The uninstall procedure has failed, leaving 9 options in the database
    • db_upgraded
    • recovery_mode_email_last_sent
    • wwsd_woocommerce_wholesale_discount_curr_ver
    • can_compress_scripts
    • widget_recent-comments
    • wwsd_discount_type
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=wwsd-wholesale-discount
    • > Error in wp-content/plugins/woo-wholesale-discount/classes/class-wwd-main.php+1087
    Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/woo-wholesale-discount/classes/class-wwd-main.php:1087
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): WwsdWholesaleDiscountClass::wwsd_wholesale_discount_submenu_callback()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin.php(259): do_action()
    #4 {main}
    thrown

SRP Passed 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
No output text or server-side errors detected on direct access of PHP files

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=wwsd-wholesale-discount
    • > Console-api (severe) in wp-content/plugins/woo-wholesale-discount/assets/js/woo-cat-choices.js?ver=6.3.1+0:24242
    Could not find passed element or passed element was of an invalid type

Optimizations

Plugin configuration 93% 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
These attributes need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Global Settings page of plugin), #2 (Set Discount rule for product), #3 (Sample of Category Discount rule), #4 (Sample of Cart page view), #5 (Sample of Checkout page view), #6 (Sample of Order detail page view)
Please take inspiration from this readme.txt

woo-wholesale-discount/woo-wholesale-discount.php 92% from 13 tests

The main PHP file in "WooCommerce Wholesale Discount" ver. 1.4 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Text Domain: The text domain should only use lowercase characters and dashes

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
Success! There were no dangerous files found in this plugin2,344 lines of code in 11 files:
LanguageFilesBlank linesComment linesLines of code
PHP24262581,476
CSS56612602
JavaScript49784266

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.55
Average class complexity322.00
▷ Minimum class complexity322.00
▷ Maximum class complexity322.00
Average method complexity12.89
▷ Minimum method complexity1.00
▷ Maximum method complexity85.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods27
▷ Static methods2592.59%
▷ Public methods27100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.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
6 PNG files occupy 0.16MB with 0.07MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png36.99KB19.89KB▼ 46.24%
screenshot-6.png10.46KB6.96KB▼ 33.45%
screenshot-3.png34.38KB18.07KB▼ 47.44%
screenshot-2.png27.21KB15.76KB▼ 42.08%
screenshot-4.png21.93KB11.48KB▼ 47.66%