taxjar / taxjar-woocommerce-plugin

WooCommerce Sales Tax Plugin by TaxJar
http://www.taxjar.com/woocommerce-sales-tax-plugin/
GNU General Public License v2.0
30 stars 29 forks source link

Consider returning instead of exiting when WC/PHP reqs are not met #238

Open xristos3490 opened 2 years ago

xristos3490 commented 2 years ago

Description

Currently, there is an exit() function when certain requirements are not met in the activation process. See https://github.com/taxjar/taxjar-woocommerce-plugin/blob/master/taxjar-woocommerce.php#L161-L168

This check results in errors when hosts manage the plugins using WP-CLI in conjunction with the --skip-plugins argument. Therefore, the plugin cannot be activated using wp-cli in isolation mode.

e.g.,

> wp plugin activate taxjar-simplified-taxes-for-woocommerce --skip-plugins --skip-themes

<strong>Please activate WooCommerce before activating TaxJar.</strong>% 

Expected solution

Consider bailing early with return calls instead of exiting. This part also seems relative: https://github.com/taxjar/taxjar-woocommerce-plugin/blob/master/taxjar-woocommerce.php#L27-L36 but i guess the register_activation_hook() runs independently. If so, TaxJar might need a small refactor to play well with the best practices.

dallendalton commented 2 years ago

@xristos3490 Thanks for submitting this! We are looking into it and will post updates in this thread.