Skip to content

Commit 7ff4dda

Browse files
hasinur1997tareq1988
authored andcommitted
Add require notice (#33)
* Add require notice * Added {order_discount} and {order_shipping} dynamic values to custom integration * Add admin notice
1 parent 0fdf327 commit 7ff4dda

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

conversion-tracking.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff 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

278291
function wcct_init() {

0 commit comments

Comments
 (0)