10% cart-deals-for-woocommerce

Code Review | Cart Deals for WooCommerce

WordPress plugin Cart Deals for WooCommerce scored 10% from 54 tests.

About plugin

  • Plugin page: cart-deals-for-wo...
  • Plugin version: 1.0.6.7
  • PHP version: 7.4.16
  • WordPress compatibility: 2.4.0-5.9
  • WordPress version: 5.8.1
  • First release: Apr 12, 2014
  • Latest release: Aug 23, 2021
  • Number of updates: 101
  • Update frequency: every 26.7 days
  • Top authors: vark (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

70+ active / 12,803 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
These installer errors require your attention
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/cart-deals-for-woocommerce/vt-cart-deals.php+513
    Function create_function() is deprecated

Server metrics [RAM: ▲0.35MB] [CPU: ▼137.76ms] Passed 4 tests

This is a short check of server-side resources used by Cart Deals for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.09 ▲0.3736.90 ▲14.95
Dashboard /wp-admin3.41 ▲0.3656.93 ▲10.82
Posts /wp-admin/edit.php3.46 ▲0.3551.89 ▲4.00
Add New Post /wp-admin/post-new.php5.76 ▲0.3395.67 ▼569.93
Media Library /wp-admin/upload.php3.35 ▲0.3537.33 ▲4.09
Upgrade to Pro /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_pro_upgrade3.3233.15
Cart Deals Help /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_show_help_page3.3229.38
Cart Deals Rules /wp-admin/edit.php?post_type=vtcrt-rule3.4136.19
Cart Deals Categories /wp-admin/edit-tags.php?taxonomy=vtcrt_rule_category&post_type=product3.3338.43
Cart Deal Settings /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_setup_options_page3.3031.66
Add New /wp-admin/post-new.php?post_type=vtcrt-rule3.3439.21

Server storage [IO: ▲2.45MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
No storage issues were detected
Filesystem: 68 new files
Database: 3 new tables, 3 new options
New tables
wp_vtcrt_purchase_log
wp_vtcrt_purchase_log_product_rule
wp_vtcrt_purchase_log_product
New WordPress options
vtcrt_setup_options
recovery_mode_email_last_sent
vtcrt_rule_category_children

Browser metrics Passed 4 tests

A check of browser resources used by Cart Deals for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,869 ▲26316.55 ▲1.0913.08 ▲3.2554.34 ▲1.82
Dashboard /wp-admin3,028 ▲975.92 ▼0.21137.84 ▼8.89127.55 ▲16.68
Posts /wp-admin/edit.php2,794 ▲552.81 ▼0.0170.14 ▲0.9293.98 ▼5.13
Add New Post /wp-admin/post-new.php1,707 ▲2418.89 ▲0.09407.59 ▲22.87112.81 ▲0.23
Media Library /wp-admin/upload.php1,862 ▲555.03 ▲0.02147.13 ▼9.08118.38 ▼5.44
Upgrade to Pro /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_pro_upgrade1,2662.2159.36146.84
Cart Deals Help /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_show_help_page1,0642.4453.4258.72
Cart Deals Rules /wp-admin/edit.php?post_type=vtcrt-rule1,4913.1074.8367.29
Cart Deals Categories /wp-admin/edit-tags.php?taxonomy=vtcrt_rule_category&post_type=product1,8412.5165.3894.96
Cart Deal Settings /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_setup_options_page5,5532.7166.22182.28
Add New /wp-admin/post-new.php?post_type=vtcrt-rule1,7362.5449.9781.52

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 3 tables in the database
    • wp_vtcrt_purchase_log_product_rule
    • wp_vtcrt_purchase_log
    • wp_vtcrt_purchase_log_product
  • This plugin does not fully uninstall, leaving 3 options in the database
    • recovery_mode_email_last_sent
    • vtcrt_rule_category_children
    • vtcrt_setup_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/edit-tags.php?taxonomy=vtcrt_rule_category&post_type=product
    • > Notice in wp-admin/includes/class-wp-terms-list-table.php+584
    Trying to get property 'show_ui' of non-object
    • > GET request to /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_setup_options_page
    • > Warning in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-setup-options.php+288
    Use of undefined constant VTCRT_DOCUMENTATION_PATH - assumed 'VTCRT_DOCUMENTATION_PATH' (this will throw an Error in a future version of PHP)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_setup_options_page
    • > Warning in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-show-help-functions.php+117
    Use of undefined constant VTCRT_PARENT_PLUGIN_TEXTNAME - assumed 'VTCRT_PARENT_PLUGIN_TEXTNAME' (this will throw an Error in a future version of PHP)
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_setup_options_page
    • > Warning in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-show-help-functions.php+117
    Use of undefined constant VTCRT_PARENT_PLUGIN_ABBREV - assumed 'VTCRT_PARENT_PLUGIN_ABBREV' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Warning in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-rules-ui.php+118
    sizeof(): Parameter must be an array or an object that implements Countable
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-rules-ui.php+120
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-rules-ui.php+120
    Trying to get property 'post_id' of non-object
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/core/vtcrt-rules-classes.php+458
    Undefined property: VTCRT_Rule::$rule_type_framework_key
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/core/vtcrt-rules-classes.php+459
    Undefined property: VTCRT_Rule::$rule_type_name
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/core/vtcrt-rules-classes.php+513
    Undefined property: VTCRT_Rule::$actionPop_same_as_inPop
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/core/vtcrt-rules-classes.php+531
    Undefined property: VTCRT_Rule::$anyChoiceOut_max
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/core/vtcrt-rules-classes.php+534
    Undefined property: VTCRT_Rule::$actionPop_threshHold_amt
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Notice in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-rules-ui.php+141
    Undefined variable: content
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Error in wp-content/plugins/cart-deals-for-woocommerce/woo-integration/vtcrt-parent-functions.php+577
    Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/cart-deals-for-woocommerce/woo-integration/vtcrt-parent-functions.php:577
    Stack trace:
    #0 wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-rules-ui.php(229): vtcrt_get_currency_symbol()
    #1 wp-admin/includes/template.php(1395): VTCRT_Rules_UI->vtcrt_deal()
    #2 wp-admin/edit-form-advanced.php(688): do_meta_boxes()
    #3 wp-admin/post-new.php(75): require('/var/www/wordpr...')
    #4 {main}
    thrown

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 8× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-rules-ui-framework.php:34
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/cart-deals-for-woocommerce/woo-integration/vtcrt-parent-functions.php:2317
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/cart-deals-for-woocommerce/woo-integration/vtcrt-parent-definitions.php:27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/cart-deals-for-woocommerce/vt-cart-deals.php:55
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cart-deals-for-woocommerce/woo-integration/vtcrt-parent-cart-validation.php:202
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cart-deals-for-woocommerce/admin/vtcrt-setup-options.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/cart-deals-for-woocommerce/woo-integration/vtcrt-parent-theme-functions.php:32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _x() in wp-content/plugins/cart-deals-for-woocommerce/core/vtcrt-backbone.php:15

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
    • > GET request to /wp-admin/edit.php?post_type=vtcrt-rule&page=vtcrt_pro_upgrade
    • > Network (severe)
    wp-content/plugins/cart-deals-for-wp-e-commerce/admin/images/upgrade-bkgrnd-banner.png - Failed to load resource: the server responded with a status of 404 (Not Found)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1 1:31592 "jQuery.Deferred exception: Cannot read properties of null (reading 'length')" "TypeError: Cannot read properties of null (reading 'length')\n at reload_PricingType_Titles_catalog (/wp-content/plugins/cart-deals-for-woocommerce/admin/js/vtcrt-admin-script.js?ver=5.8.1:636:64)\n at cartOrCatalogTest (/wp-content/plugins/cart-deals-for-woocommerce/admin/js/vtcrt-admin-script.js?ver=5.8.1:215:35)\n at firstTimeThroughControl (/wp-content/plugins/cart-deals-for-woocommerce/admin/js/vtcrt-admin-script.js?ver=5.8.1:120:30)\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/cart-deals-for-woocommerce/admin/js/vtcrt-admin-script.js?ver=5.8.1:32:28)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1:2:30340)" undefined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=vtcrt-rule
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.8.1 1:31702 Uncaught TypeError: Cannot read properties of null (reading 'length')

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Screenshots: These screenshots require images: #1 (Cart Deals - Add New Rule Basic), #2 (Cart Deals - Add New Rule Advanced Lower Area), #3 (Cart Deals - Add New Rule Advanced Upper Area), #4 (Cart Deals - Cart Widget with Discount), #5 (Cart Deals - Checkout with Discount)
  • Tags: You are using too many tags: 26 tag instead of maximum 10
You can take inspiration from this readme.txt

cart-deals-for-woocommerce/vt-cart-deals.php 85% from 13 tests

Analyzing the main PHP file in "Cart Deals for WooCommerce" version 1.0.6.7
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 ("cart-deals-for-woocommerce.php" instead of "vt-cart-deals.php")
  • Requires at least: Required version must match the one declared in readme.txt ("3.3" instead of "2.4.0")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected22,852 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP163,5805,29617,170
JavaScript43904503,040
CSS91783362,642

PHP code 50% from 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 108)
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity68.81
▷ Minimum class complexity1.00
▷ Maximum class complexity327.00
Average method complexity5.58
▷ Minimum method complexity1.00
▷ Maximum method complexity108.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes16
▷ Abstract classes00.00%
▷ Concrete classes16100.00%
▷ Final classes00.00%
Methods237
▷ Static methods00.00%
▷ Public methods237100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions118
▷ Named functions118100.00%
▷ Anonymous functions00.00%
Constants22
▷ Global constants22100.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
25 PNG files occupy 0.22MB with 0.09MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/css/smoothness/images/ui-icons_222222_256x240.png6.76KB4.17KB▼ 38.24%
admin/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.27KB0.18KB▼ 35.00%
admin/css/smoothness/images/ui-icons_454545_256x240.png6.83KB4.17KB▼ 38.86%
admin/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png0.33KB0.12KB▼ 62.09%
admin/css/smoothness/images/ui-icons_888888_256x240.png6.83KB4.17KB▼ 38.92%