78% woo-discount-price

Code Review | Discount and regular price cart and checkout page display WooCommerce

WordPress plugin Discount and regular price cart and checkout page display WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: woo-discount-price
  • Plugin version: 1.3.8
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 7.0-6.4
  • WordPress version: 6.3.1
  • First release: Aug 9, 2017
  • Latest release: Nov 8, 2023
  • Number of updates: 78
  • Update frequency: every 29.3 days
  • Top authors: cristiano.zanca (100%)

Code review

54 tests

User reviews

15 reviews

Install metrics

3,000+ active /43,727 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.05MB] [CPU: ▼2.60ms] Passed 4 tests

This is a short check of server-side resources used by Discount and regular price cart and checkout page display WooCommerce
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0634.91 ▼7.72
Dashboard /wp-admin3.37 ▲0.0250.61 ▼4.89
Posts /wp-admin/edit.php3.48 ▲0.1351.01 ▲4.81
Add New Post /wp-admin/post-new.php5.95 ▲0.0696.68 ▲0.54
Media Library /wp-admin/upload.php3.29 ▲0.0635.85 ▲1.67
Discount Price /wp-admin/admin.php?page=woo-discount-price3.2634.33

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 17 new files
Database: no new tables, 9 new options
New WordPress options
widget_recent-comments
can_compress_scripts
woodiscpr_you_save
widget_theysaidso_widget
theysaidso_admin_options
count_load_time_woo_discount
db_upgraded
woodiscpr_taxexcl
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Discount and regular price cart and checkout page display WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲4214.26 ▲0.011.54 ▼0.2136.86 ▼7.02
Dashboard /wp-admin2,203 ▲235.54 ▼0.0890.47 ▲2.2341.02 ▲1.83
Posts /wp-admin/edit.php2,118 ▲182.00 ▲0.0541.56 ▲1.0936.03 ▼5.93
Add New Post /wp-admin/post-new.php1,535 ▲923.40 ▲0.22662.73 ▲6.2580.73 ▲31.70
Media Library /wp-admin/upload.php1,417 ▲204.17 ▼0.0297.71 ▼1.4241.81 ▼0.76
Discount Price /wp-admin/admin.php?page=woo-discount-price8572.1727.9425.23

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • woodiscpr_taxexcl
    • can_compress_scripts
    • widget_theysaidso_widget
    • count_load_time_woo_discount
    • widget_recent-posts

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

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
Almost there! Just fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/woo-discount-price/inc/setup-file.php
  • 2× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-discount-price/woo-discount-price.php:24
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woo-discount-price/inc/notice_recensione.php:75

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)
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 13 tag instead of maximum 10
Please take inspiration from this readme.txt

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

The principal PHP file in "Discount and regular price cart and checkout page display WooCommerce" v. 1.3.8 is loaded by WordPress automatically on each request
Please take the time to fix the following:
  • Requires at least: Required version must match the one declared in readme.txt ("5.0" instead of "7.0")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
No dangerous file extensions were detected414 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP1024448360
PO File2141848
CSS1006

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity6.00
▷ Minimum class complexity6.00
▷ Maximum class complexity6.00
Average method complexity1.80
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods6
▷ Static methods00.00%
▷ Public methods6100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions12
▷ Named functions1191.67%
▷ Anonymous functions18.33%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 compressed PNG file occupies 0.01MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/image/email_discount_price.png11.79KB10.03KB▼ 14.96%