90% sale-discount-for-woocommerce

Code Review | Sale price as order discount for WooCommerce

WordPress plugin Sale price as order discount for WooCommerce scored90%from 54 tests.

About plugin

  • Plugin page: sale-discount-for...
  • Plugin version: 1.1.4
  • PHP compatiblity: 7.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.4
  • WordPress version: 6.3.1
  • First release: Dec 16, 2021
  • Latest release: Nov 8, 2023
  • Number of updates: 15
  • Update frequency: every 46.1 days
  • Top authors: wpovernight (73.33%)pomegranate (33.33%)

Code review

54 tests

User reviews

1 review

Install metrics

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

Server metrics [RAM: ▲0.04MB] [CPU: ▼5.72ms] Passed 4 tests

Analyzing server-side resources used by Sale price as order discount for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0436.64 ▼3.96
Dashboard /wp-admin3.35 ▲0.0447.91 ▼1.04
Posts /wp-admin/edit.php3.46 ▲0.1044.78 ▼3.79
Add New Post /wp-admin/post-new.php5.93 ▲0.0491.73 ▼11.13
Media Library /wp-admin/upload.php3.27 ▲0.0332.18 ▼4.00

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

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

Browser metrics Passed 4 tests

Checking browser requirements for Sale price as order discount for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,798 ▲3614.35 ▼0.361.66 ▼0.0139.88 ▼1.42
Dashboard /wp-admin2,203 ▲235.58 ▲0.0490.76 ▲0.1638.32 ▼6.45
Posts /wp-admin/edit.php2,108 ▲52.01 ▼0.0139.73 ▼2.2738.66 ▲3.28
Add New Post /wp-admin/post-new.php1,543 ▲1725.20 ▲1.81624.62 ▼25.8565.73 ▲14.13
Media Library /wp-admin/upload.php1,411 ▲84.21 ▼0.01101.15 ▲2.3543.59 ▼1.56

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP Passed 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
No output text or server-side errors detected on direct access of PHP files

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
4 plugin tags: sale price, regular price, woocommerce, discount

sale-discount-for-woocommerce/sale-discount-for-woocommerce.php Passed 13 tests

The main PHP script in "Sale price as order discount for WooCommerce" version 1.1.4 is automatically included on every request by WordPress
132 characters long description:
Stores the regular price of products in the order data so that the customer sees the discount they received in email/account/invoice

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Everything looks great! No dangerous files found in this plugin227 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP133139142
PO File2183085

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity24.00
▷ Minimum class complexity24.00
▷ Maximum class complexity24.00
Average method complexity2.44
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods16
▷ Static methods16.25%
▷ Public methods1487.50%
▷ Protected methods00.00%
▷ Private methods212.50%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.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
There were not PNG files found in your plugin