51% pricing-deals-for-woocommerce

Code Review | Pricing Deals for WooCommerce

WordPress plugin Pricing Deals for WooCommerce scored 51% from 54 tests.

About plugin

  • Plugin page: pricing-deals-for...
  • Plugin version: 2.0.2.02
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.4.0-5.9
  • WordPress version: 5.9.2
  • First release: Mar 16, 2014
  • Latest release: Aug 23, 2021
  • Number of updates: 356
  • Update frequency: every 7.6 days
  • Top authors: vark (100%)

Code review

54 tests

User reviews

175 reviews

Install metrics

6,000+ active / 333,610 total downloads

Benchmarks

Plugin footprint 48% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.29MB] [CPU: ▼330.42ms] Passed 4 tests

A check of server-side resources used by Pricing Deals for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /5.72 ▲2.2028.90 ▼26.10
Dashboard /wp-admin5.66 ▲2.2524.12 ▼15.86
Posts /wp-admin/edit.php5.66 ▲2.0223.52 ▼19.70
Add New Post /wp-admin/post-new.php5.66 ▼1.3126.05 ▼1,260.00
Media Library /wp-admin/upload.php5.66 ▲2.3628.90 ▼8.61
Pricing Deals Rules /wp-admin/edit.php?post_type=vtprd-rule5.6623.61
Pricing Deals Help /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_show_help_page5.6623.86
Upgrade to Pro /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_pro_upgrade5.6626.03
Register Pro License /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_license_options_page5.6630.92
Add New /wp-admin/post-new.php?post_type=vtprd-rule5.6626.42
Pricing Deals Categories /wp-admin/edit-tags.php?taxonomy=vtprd_rule_category&post_type=product5.6631.05
Pricing Deal Settings /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_setup_options_page5.6632.04

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 82 new files
Database: 4 new tables, 7 new options
New tables
wp_vtprd_purchase_log
wp_vtprd_purchase_log_product_rule
wp_vtprd_purchase_log_product
wp_vtprd_transient_cart_data
New WordPress options
vtprd_no_check_on_activation
vtprd_ip_address
vtprd_setup_options
vtprd_rule_category_children
recovery_mode_email_last_sent
vtprd_license_options
vtprd_data_update_options

Browser metrics Passed 4 tests

An overview of browser requirements for Pricing Deals for WooCommerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,955 ▲20116.28 ▲0.618.69 ▲1.742.19 ▼0.53
Dashboard /wp-admin2,969 ▲1086.18 ▼0.11118.91 ▼18.77173.54 ▲8.97
Posts /wp-admin/edit.php2,769 ▲843.23 ▼0.0166.79 ▲1.40161.39 ▲15.04
Add New Post /wp-admin/post-new.php1,743 ▲5321.71 ▲0.44436.47 ▼22.34159.73 ▲0.81
Media Library /wp-admin/upload.php1,781 ▲865.53 ▲0.05147.06 ▲4.39205.82 ▲22.40
Pricing Deals Rules /wp-admin/edit.php?post_type=vtprd-rule1,4093.1663.80134.08
Pricing Deals Help /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_show_help_page1,0562.4154.57101.88
Upgrade to Pro /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_pro_upgrade1,2532.5055.07236.35
Register Pro License /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_license_options_page1,8492.7164.33235.20
Add New /wp-admin/post-new.php?post_type=vtprd-rule1,7072.3261.55129.22
Pricing Deals Categories /wp-admin/edit-tags.php?taxonomy=vtprd_rule_category&post_type=product1,8322.7960.81164.33
Pricing Deal Settings /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_setup_options_page3,9823.0364.52287.39

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php+5434
    Use of undefined constant WC_VERSION - assumed 'WC_VERSION' (this will throw an Error in a future version of PHP)
  • This plugin does not fully uninstall, leaving 4 tables in the database
    • wp_vtprd_purchase_log_product_rule
    • wp_vtprd_purchase_log_product
    • wp_vtprd_transient_cart_data
    • wp_vtprd_purchase_log
  • The uninstall procedure has failed, leaving 7 options in the database
    • vtprd_setup_options
    • vtprd_rule_category_children
    • vtprd_license_options
    • recovery_mode_email_last_sent
    • vtprd_data_update_options
    • vtprd_ip_address
    • vtprd_no_check_on_activation

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)
These server-side errors were triggered
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_setup_options_page
    • > Warning in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php+5434
    Use of undefined constant WC_VERSION - assumed 'WC_VERSION' (this will throw an Error in a future version of PHP)
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_setup_options_page
    • > Warning in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php+4349
    Use of undefined constant WOOCOMMERCE_VERSION - assumed 'WOOCOMMERCE_VERSION' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_show_help_page
    • > Notice in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-setup-options.php+266
    Undefined index: doThis
    • > GET request to /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_license_options_page
    • > Notice in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-license-options.php+780
    Undefined index: updater_action_reduced_frequency
    • > GET request to /wp-admin/edit.php?post_type=vtprd-rule&page=vtprd_license_options_page
    • > Notice in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php+6856
    Undefined variable: timeout
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Warning in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-rules-ui.php+538
    sizeof(): Parameter must be an array or an object that implements Countable
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Notice in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-rules-ui.php+540
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Notice in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-rules-ui.php+540
    Trying to get property 'post_id' of non-object
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Error in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php+1736
    Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php:1736
    Stack trace:
    #0 wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-rules-ui.php(746): vtprd_get_currency_symbol()
    #1 wp-admin/includes/template.php(1395): VTPRD_Rules_UI->vtprd_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
    • > GET request to /wp-admin/edit-tags.php?taxonomy=vtprd_rule_category&post_type=product
    • > Notice in wp-admin/includes/class-wp-terms-list-table.php+575
    Trying to get property 'show_ui' of non-object

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 take a closer look at the following
  • 9× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-license-options.php:148
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-rules-ui-framework.php:27
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-definitions.php:28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-functions.php:730
    • > PHP Fatal error
      Uncaught Error: Call to undefined function taxonomy_exists() in wp-content/plugins/pricing-deals-for-woocommerce/core/vtprd-backbone.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-theme-functions.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/pricing-deals-for-woocommerce/woo-integration/vtprd-parent-cart-validation.php:177
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pricing-deals-for-woocommerce/admin/vtprd-setup-options.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/pricing-deals-for-woocommerce/vt-pricing-deals.php:69

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver=5.9.2 1:31592 "jQuery.Deferred exception: Cannot read properties of null (reading 'length')" "TypeError: Cannot read properties of null (reading 'length')\n at /wp-content/plugins/pricing-deals-for-woocommerce/admin/js/vtprd-admin-script-v006.min.js?ver=5.9.2:1:1974\n at t (/wp-content/plugins/pricing-deals-for-woocommerce/admin/js/vtprd-admin-script-v006.min.js?ver=5.9.2:1:2196)\n at /wp-content/plugins/pricing-deals-for-woocommerce/admin/js/vtprd-admin-script-v006.min.js?ver=5.9.2:1:50381\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/pricing-deals-for-woocommerce/admin/js/vtprd-admin-script-v006.min.js?ver=5.9.2:1:50691)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver=5.9.2:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver=5.9.2:2:30340)" undefined
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Network (severe)
    wp-admin/undefined/admin/images/indicator.gif - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/post-new.php?post_type=vtprd-rule
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate&ver=5.9.2 1:31702 Uncaught TypeError: Cannot read properties of null (reading 'length')

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Tags: Please delete some tags, you are using 13 tag instead of maximum 10
  • Screenshots: These screenshots do not have images: #1 (Pricing Deals - Add New Rule Basic Lower Area), #2 (Pricing Deals - Add New Rule Top Area), #3 (Pricing Deals - Cart Widget with Discount), #4 (Pricing Deals - Checkout with Discount)
You can take inspiration from this readme.txt

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

The main PHP file in "Pricing Deals for WooCommerce" ver. 2.0.2.02 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Requires at least: Required version must be the same as the one declared in readme.txt ("3.3" instead of "2.4.0")
  • Main file name: The principal plugin file should be the same as the plugin slug ("pricing-deals-for-woocommerce.php" instead of "vt-pricing-deals.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin41,549 lines of code in 41 files:
LanguageFilesBlank linesComment linesLines of code
PHP208,53614,18131,167
PO File11,5231,9234,260
CSS122374823,394
JavaScript84276492,728

PHP code 50% from 2 tests

An overview of cyclomatic complexity and code structure
Please tend to the following items
  • Method cyclomatic complexity should be reduced to less than 100 (currently 281)
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity151.75
▷ Minimum class complexity1.00
▷ Maximum class complexity697.00
Average method complexity9.59
▷ Minimum method complexity1.00
▷ Maximum method complexity281.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes20
▷ Abstract classes00.00%
▷ Concrete classes20100.00%
▷ Final classes00.00%
Methods351
▷ Static methods00.00%
▷ Public methods34899.15%
▷ Protected methods00.00%
▷ Private methods30.85%
Functions194
▷ Named functions18997.42%
▷ Anonymous functions52.58%
Constants39
▷ Global constants39100.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
29 PNG files occupy 0.15MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/minus-toggle2.png0.46KB0.42KB▼ 9.19%
admin/images/sale-circle.png3.80KB3.94KB0.00%
admin/css/smoothness/images/ui-icons_cd0a0a_256x240.png4.44KB4.17KB▼ 6.02%
admin/css/smoothness/images/ui-icons_222222_256x240.png6.76KB4.17KB▼ 38.24%
admin/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png0.21KB0.08KB▼ 58.96%