84% woo-custom-add-to-cart-button

Code Review | WooCommerce Custom Add To Cart Button

WordPress plugin WooCommerce Custom Add To Cart Button scored84%from 54 tests.

About plugin

  • Plugin page: woo-custom-add-to...
  • Plugin version: 1.2.2
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-6.3
  • WordPress version: 6.3.1
  • First release: Feb 22, 2018
  • Latest release: Aug 15, 2023
  • Number of updates: 27
  • Update frequency: every 74.3 days
  • Top authors: andykeith (96.3%)amirition (7.41%)

Code review

54 tests

User reviews

7 reviews

Install metrics

10,000+ active /126,120 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.17MB] [CPU: ▼9.10ms] Passed 4 tests

Analyzing server-side resources used by WooCommerce Custom Add To Cart Button
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.66 ▲0.2048.48 ▼1.20
Dashboard /wp-admin3.50 ▲0.2059.51 ▲1.33
Posts /wp-admin/edit.php3.55 ▲0.2054.70 ▼5.68
Add New Post /wp-admin/post-new.php6.02 ▲0.1388.73 ▼20.79
Media Library /wp-admin/upload.php3.36 ▲0.1343.96 ▼8.72

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for WooCommerce Custom Add To Cart Button
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.30 ▼0.442.17 ▲0.3748.93 ▲4.25
Dashboard /wp-admin2,192 ▲245.53 ▼0.0195.57 ▼1.1940.50 ▼2.04
Posts /wp-admin/edit.php2,100 ▼32.05 ▼0.0042.10 ▼2.6532.59 ▼10.19
Add New Post /wp-admin/post-new.php1,545 ▼023.20 ▲0.34708.03 ▲32.3653.02 ▼3.47
Media Library /wp-admin/upload.php1,403 ▲94.25 ▲0.10115.98 ▼45.8648.35 ▼23.17

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
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 6× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Interface 'Barn2\\WCB_Lib\\Registerable' not found in wp-content/plugins/woo-custom-add-to-cart-button/src/Add_To_Cart_Styles.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Barn2\\WCB_Lib\\Registerable' not found in wp-content/plugins/woo-custom-add-to-cart-button/src/Add_To_Cart_Replacer.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'Barn2\\WCB_Lib\\Registerable' not found in wp-content/plugins/woo-custom-add-to-cart-button/lib/Plugin/Admin/Admin_Links.php:18
    • > PHP Fatal error
      Uncaught Error: Interface 'Barn2\\WCB_Lib\\Plugin\\Plugin' not found in wp-content/plugins/woo-custom-add-to-cart-button/lib/Plugin/Simple_Plugin.php:17
    • > PHP Fatal error
      Uncaught Error: Interface 'Barn2\\WCB_Lib\\Registerable' not found in wp-content/plugins/woo-custom-add-to-cart-button/src/Admin/Add_To_Cart_Customizer.php:15
    • > PHP Fatal error
      Uncaught Error: Class 'Barn2\\WCB_Lib\\Plugin\\Simple_Plugin' not found in wp-content/plugins/woo-custom-add-to-cart-button/src/Plugin.php:21

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
3 plugin tags: button, cart, woocommerce

woo-custom-add-to-cart-button/woo-custom-add-to-cart-button.php 85% from 13 tests

The main PHP script in "WooCommerce Custom Add To Cart Button" version 1.2.2 is automatically included on every request by WordPress
You should first fix the following items:
  • Requires at least: Required version must match the one declared in readme.txt ("5.2" instead of "3.7")
  • Git Repository: There should be no Git repositories present in your plugin

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected4,261 lines of code in 34 files:
LanguageFilesBlank linesComment linesLines of code
JSON4003,144
PHP24249484934
Sass112162
CSS246352
JavaScript16037
YAML20032

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity6.68
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.24
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces6
Interfaces6
Traits1
Classes12
▷ Abstract classes00.00%
▷ Concrete classes12100.00%
▷ Final classes00.00%
Methods104
▷ Static methods2322.12%
▷ Public methods10197.12%
▷ Protected methods00.00%
▷ Private methods32.88%
Functions5
▷ Named functions240.00%
▷ Anonymous functions360.00%
Constants11
▷ Global constants00.00%
▷ Class constants11100.00%
▷ Public constants11100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
4 PNG files occupy 0.09MB with 0.05MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
.wordpress-org/icon-256x256.png8.48KB3.99KB▼ 52.98%
.wordpress-org/banner-772x250.png30.34KB12.12KB▼ 60.06%
.wordpress-org/icon-128x128.png4.18KB2.22KB▼ 46.89%
.wordpress-org/banner-1544x500.png52.64KB21.58KB▼ 59.00%