File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,6 @@ public function __construct() {
7676 $ this ->init_classes ();
7777
7878 register_activation_hook ( __FILE__ , array ( $ this , 'activate ' ) );
79-
8079 do_action ( 'wcct_loaded ' );
8180 }
8281
@@ -180,7 +179,7 @@ public function init_hooks() {
180179 add_action ( 'plugins_loaded ' , array ( $ this , 'plugin_upgrades ' ) );
181180 add_action ( 'init ' , array ( $ this , 'localization_setup ' ) );
182181 add_action ( 'init ' , array ( $ this , 'init_tracker ' ) );
183-
182+ add_action ( ' admin_notices ' , array ( $ this , ' check_woocommerce_exist ' ) );
184183 add_filter ( 'plugin_action_links_ ' . plugin_basename ( __FILE__ ), array ( $ this , 'plugin_action_links ' ) );
185184 }
186185
@@ -273,6 +272,20 @@ function plugin_action_links( $links ) {
273272
274273 return $ links ;
275274 }
275+ /**
276+ * Check Woocommerce exist
277+ *
278+ * @return void
279+ */
280+ public function check_woocommerce_exist () {
281+ if ( ! function_exists ( 'WC ' ) ) {
282+ ?>
283+ <div class="error notice is-dismissible">
284+ <p><?php _e ( '<b>Woocommerce conversion tracking</b> requires <a target="_blank" href="https://wordpress.org/plugins/woocommerce/">Woocommerce</a> ' , 'woocommerce-conversion-tracking ' );?> </p>
285+ </div>
286+ <?php
287+ }
288+ }
276289}
277290
278291function wcct_init () {
You can’t perform that action at this time.
0 commit comments