10% add-to-cart-button-for-woocommerce

Code Review | Add to Cart Button for WooCommerce

WordPress plugin Add to Cart Button for WooCommerce scored 10% from 54 tests.

About plugin

  • Plugin page: add-to-cart-butto...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.4.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-5.3
  • WordPress version: 5.9.2
  • First release: Feb 13, 2020
  • Latest release: Feb 14, 2020
  • Number of updates: 5
  • Update frequency: every 0.6 days
  • Top authors: webbykey (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 1,881 total downloads

Benchmarks

Plugin footprint 58% 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
  • This plugin did not install gracefully
    • > Notice in wp-content/plugins/add-to-cart-button-for-woocommerce/includes/class-addtocart.php+204
    Trying to access array offset on value of type bool

Server metrics [RAM: ▲1.85MB] [CPU: ▼283.10ms] Passed 4 tests

Server-side resources used by Add to Cart Button for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.09 ▲0.5751.26 ▼6.00
Dashboard /wp-admin5.82 ▲2.4161.24 ▲26.89
Posts /wp-admin/edit.php5.94 ▲2.3081.32 ▲44.06
Add New Post /wp-admin/post-new.php9.11 ▲2.13120.61 ▼1,175.19
Media Library /wp-admin/upload.php5.81 ▲2.5146.45 ▲21.92
Add to Cart Button /wp-admin/edit.php?post_type=add_to_cart_cpt3.7622.16

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 80 new files
Database: no new tables, 1 new option
New WordPress options
_addtocart_options

Browser metrics Passed 4 tests

Checking browser requirements for Add to Cart Button for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,549 ▼19318.56 ▲3.150.45 ▼5.8831.34 ▲29.15
Dashboard /wp-admin3,256 ▲3958.58 ▲2.42154.75 ▲18.83153.55 ▼22.32
Posts /wp-admin/edit.php3,086 ▲4015.89 ▲2.6499.75 ▲30.22168.03 ▲13.46
Add New Post /wp-admin/post-new.php1,785 ▲12423.42 ▲7.14416.41 ▼6.51180.64 ▼27.65
Media Library /wp-admin/upload.php1,868 ▲1706.93 ▲1.42116.27 ▼24.77197.81 ▼53.19
Sticky Button on Product Page /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=3280.940.0317.79
Button on Product Page /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=2280.940.0318.97
Button on Shop page /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=1280.940.0418.39
Advanced Settings /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=4280.940.0416.34
Add to Cart Button /wp-admin/edit.php?post_type=add_to_cart_cpt280.940.0317.19

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 1 option in the database
    • _addtocart_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

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
No output text or server-side errors detected on direct access of PHP files

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please take a look at the following user-side issues
    • > GET request to /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=3
    • > Network (severe)
    wp-admin/edit.php?post_type=add_to_cart_cpt#tab=3 - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=2
    • > Network (severe)
    wp-admin/edit.php?post_type=add_to_cart_cpt#tab=2 - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=1
    • > Network (severe)
    wp-admin/edit.php?post_type=add_to_cart_cpt#tab=1 - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/edit.php?post_type=add_to_cart_cpt#tab=4
    • > Network (severe)
    wp-admin/edit.php?post_type=add_to_cart_cpt#tab=4 - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/edit.php?post_type=add_to_cart_cpt
    • > Network (severe)
    wp-admin/edit.php?post_type=add_to_cart_cpt - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 93% from 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
5 plugin tags: add to cart button, custom add to cart button woocommerce, add to cart, woocommerce, sticky add to cart

add-to-cart-button-for-woocommerce/wk-add-to-cart-button.php 85% from 13 tests

The entry point to "Add to Cart Button for WooCommerce" version 1.0.0 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("add-to-cart-button-for-woocommerce.php" instead of "wk-add-to-cart-button.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

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
Good job! No executable or dangerous file extensions detected15,835 lines of code in 67 files:
LanguageFilesBlank linesComment linesLines of code
PHP521,3591,2575,467
CSS72884633,920
JavaScript51,1923343,775
SVG3002,673

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.61
Average class complexity21.34
▷ Minimum class complexity1.00
▷ Maximum class complexity121.00
Average method complexity6.56
▷ Minimum method complexity1.00
▷ Maximum method complexity52.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes38
▷ Abstract classes25.26%
▷ Concrete classes3694.74%
▷ Final classes00.00%
Methods139
▷ Static methods2517.99%
▷ Public methods13294.96%
▷ Protected methods10.72%
▷ Private methods64.32%
Functions29
▷ Named functions2896.55%
▷ Anonymous functions13.45%
Constants3
▷ Global constants3100.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
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/atc-framework/assets/images/checkerboard.png2.29KB2.54KB0.00%