10% easy-woocommerce-discounts

Code Review | Discount Rules and Dynamic Pricing for WooCommerce

WordPress plugin Discount Rules and Dynamic Pricing for WooCommerce scored10%from 54 tests.

About plugin

  • Plugin page: easy-woocommerce-...
  • Plugin version: 6.1.0
  • PHP compatiblity: 5.3.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.4
  • WordPress version: 6.3.1
  • First release: Apr 13, 2019
  • Latest release: Nov 20, 2023
  • Number of updates: 69
  • Update frequency: every 24.4 days
  • Top authors: asanaplugins (100%)

Code review

54 tests

User reviews

199 reviews

Install metrics

7,000+ active /191,321 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Error in wp-content/plugins/easy-woocommerce-discounts/includes/class-wccs-settings-manager.php+165
    Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/easy-woocommerce-discounts/includes/class-wccs-settings-manager.php:165
    Stack trace:
    #0 wp-content/plugins/easy-woocommerce-discounts/includes/class-wccs-activator.php(193): WCCS_Settings_Manager->get_registered_settings()
    #1 wp-content/plugins/easy-woocommerce-discounts/includes/class-wccs-activator.php(164): WCCS_Activator::create_options()
    #2 wp-content/plugins/easy-woocommerce-discounts/includes/class-wccs-activator.php(112): WCCS_Activator::run_install()
    #3 wp-content/plugins/easy-woocommerce-discounts/easy-woocommerce-discounts.php(36): WCCS_Activator::activate()
    #4 wp-includes/class-wp-hook.php(310): activate_wc_conditions()
    #5 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #6 wp-includes/plugin.php(517): WP_Hook->do_action()
    #7 /var/www/word

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

Analyzing server-side resources used by Discount Rules and Dynamic Pricing for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0036.68 ▼3.88
Dashboard /wp-admin3.31 ▲0.0044.97 ▼5.27
Posts /wp-admin/edit.php3.36 ▲0.0048.62 ▲1.54
Add New Post /wp-admin/post-new.php5.89 ▲0.0089.12 ▼6.18
Media Library /wp-admin/upload.php3.23 ▲0.0035.53 ▲2.06

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 160 new files
Database: 2 new tables, 9 new options
New tables
wp_wccs_condition_meta
wp_wccs_conditions
New WordPress options
widget_theysaidso_widget
widget_recent-posts
wccs_install_timestamp
widget_recent-comments
wp_wccs_conditions_db_version
db_upgraded
can_compress_scripts
theysaidso_admin_options
wp_wccs_condition_meta_db_version

Browser metrics Passed 4 tests

A check of browser resources used by Discount Rules and Dynamic Pricing for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲314.21 ▼0.201.68 ▼0.2036.60 ▼7.45
Dashboard /wp-admin2,192 ▲125.54 ▼0.0998.11 ▼1.4742.88 ▼4.93
Posts /wp-admin/edit.php2,103 ▲31.96 ▲0.0239.97 ▲1.1637.08 ▼1.27
Add New Post /wp-admin/post-new.php1,526 ▼1023.36 ▲0.33644.43 ▲10.6557.89 ▼1.73
Media Library /wp-admin/upload.php1,403 ▲34.19 ▼0.02103.91 ▲3.5945.51 ▲5.25

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie tables were found after uninstall: 2 tables
    • wp_wccs_condition_meta
    • wp_wccs_conditions
  • This plugin does not fully uninstall, leaving 9 options in the database
    • wp_wccs_condition_meta_db_version
    • can_compress_scripts
    • widget_theysaidso_widget
    • db_upgraded
    • wccs_install_timestamp
    • wp_wccs_conditions_db_version
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests Passed 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)
Even though everything seems fine, this is not an exhaustive test

SRP Passed 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
Congratulations! This plugin passed the SRP test

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 93% from 29 tests

readme.txt 94% 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: 23 tag instead of maximum 10
The official readme.txt might help

easy-woocommerce-discounts/easy-woocommerce-discounts.php 92% from 13 tests

"Discount Rules and Dynamic Pricing for WooCommerce" version 6.1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Requires at least: Required version must match the one declared in readme.txt ("4.4.2" instead of "3.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
No dangerous file extensions were detected11,967 lines of code in 149 files:
LanguageFilesBlank linesComment linesLines of code
PHP1122,4143,53711,067
SVG100685
JavaScript2316116112
CSS10310100
JSON3003

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity22.65
▷ Minimum class complexity1.00
▷ Maximum class complexity118.00
Average method complexity4.24
▷ Minimum method complexity1.00
▷ Maximum method complexity60.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes96
▷ Abstract classes55.21%
▷ Concrete classes9194.79%
▷ Final classes11.10%
Methods643
▷ Static methods6910.73%
▷ Public methods55486.16%
▷ Protected methods7611.82%
▷ Private methods132.02%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants545.45%
▷ Class constants654.55%
▷ Public constants6100.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