77% conditional-discount-rule-for-woocommerce

Code Review | Conditional discount / bulk discounts for WooCommerce

WordPress plugin Conditional discount / bulk discounts for WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: conditional-disco...
  • Plugin version: 1.9.37.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.4.0
  • WordPress version: 6.3.1
  • First release: Jan 1, 2020
  • Latest release: Nov 20, 2023
  • Number of updates: 167
  • Update frequency: every 8.5 days
  • Top authors: rajeshsingh520 (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

100+ active /19,972 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

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

Analyzing server-side resources used by Conditional discount / bulk discounts for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0033.48 ▼6.03
Dashboard /wp-admin3.31 ▲0.0050.64 ▲5.41
Posts /wp-admin/edit.php3.36 ▲0.0046.43 ▲2.37
Add New Post /wp-admin/post-new.php5.89 ▲0.0091.66 ▲2.44
Media Library /wp-admin/upload.php3.23 ▲0.0030.26 ▼1.22

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Conditional discount / bulk discounts for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,790 ▲2814.70 ▲0.431.72 ▲0.0936.62 ▼7.34
Dashboard /wp-admin2,195 ▲155.62 ▼0.0792.57 ▲7.0939.66 ▲0.68
Posts /wp-admin/edit.php2,100 ▼01.94 ▼0.0640.04 ▲1.5936.50 ▲0.19
Add New Post /wp-admin/post-new.php1,526 ▼923.00 ▼0.15598.86 ▼58.1456.72 ▲4.12
Media Library /wp-admin/upload.php1,394 ▼64.18 ▲0.0197.24 ▼5.0042.47 ▲1.30

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
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/conditional-discount-rule-for-woocommerce/includes/pisol.class.form.php
  • 55× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/weight.php:8
    • > PHP Warning
      Use of undefined constant PI_CDRW_SELECTION_RULE_SLUG - assumed 'PI_CDRW_SELECTION_RULE_SLUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/delivery_type.php on line 139
    • > PHP Warning
      Use of undefined constant PI_CDRW_SELECTION_RULE_SLUG - assumed 'PI_CDRW_SELECTION_RULE_SLUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/selected_delivery_day.php on line 157
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-discount-rule-for-woocommerce/public/class-future-template.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/coupon.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/user.php:8
    • > PHP Warning
      Use of undefined constant PI_CDRW_SELECTION_RULE_SLUG - assumed 'PI_CDRW_SELECTION_RULE_SLUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/shipping_class.php on line 122
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/coupons-template/class-conditional-discount-rule-woocommerce-future-coupon-lists.php:72
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/pisol_selection_rule_main.php:239
    • > PHP Warning
      Use of undefined constant PI_CDRW_SELECTION_RULE_SLUG - assumed 'PI_CDRW_SELECTION_RULE_SLUG' (this will throw an Error in a future version of PHP) in wp-content/plugins/conditional-discount-rule-for-woocommerce/admin/selection_rules/rules/quantity.php on line 126

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
Attributes that require attention: Please take inspiration from this readme.txt

conditional-discount-rule-for-woocommerce/conditional-discount-rule-woocommerce.php 85% from 13 tests

This is the main PHP file of "Conditional discount / bulk discounts for WooCommerce" version 1.9.37.6, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
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 ("conditional-discount-rule-for-woocommerce.php" instead of "conditional-discount-rule-woocommerce.php")
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin19,392 lines of code in 73 files:
LanguageFilesBlank linesComment linesLines of code
CSS52,0728810,535
PHP571,4206015,305
SVG71063,208
JavaScript46076344

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity15.57
▷ Minimum class complexity1.00
▷ Maximum class complexity57.00
Average method complexity2.85
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes44
▷ Abstract classes00.00%
▷ Concrete classes44100.00%
▷ Final classes00.00%
Methods346
▷ Static methods5215.03%
▷ Public methods34098.27%
▷ Protected methods10.29%
▷ Private methods51.45%
Functions10
▷ Named functions990.00%
▷ Anonymous functions110.00%
Constants5
▷ Global constants5100.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
31 PNG files occupy 0.16MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png0.45KB0.15KB▼ 65.65%
includes/background.png74.27KB26.29KB▼ 64.60%
admin/css/images/ui-icons_228ef1_256x240.png4.49KB4.18KB▼ 6.89%
admin/css/images/ui-bg_glass_100_f6f6f6_1x400.png0.29KB0.12KB▼ 59.47%
admin/css/images/ui-icons_ef8c08_256x240.png4.49KB4.18KB▼ 6.89%