Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Commit 3e799c1

Browse files
author
Justin Shreve
committed
Makes sure to do the dependency check after plugins have loaded, so we can correctly see if WooCommerce is active or not.
1 parent b45fe41 commit 3e799c1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

wc-api-dev.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class WC_API_Dev {
1919
/**
2020
* Minimum version needed to run this version of the API.
2121
*/
22-
const WC_MIN_VERSION = '3.0';
22+
const WC_MIN_VERSION = '3.0.0';
2323

2424
/**
2525
* Class Instance.
@@ -31,7 +31,7 @@ class WC_API_Dev {
3131
*/
3232
public function __construct() {
3333
add_action( 'woocommerce_init', array( $this, 'init' ) );
34-
$this->check_dependencies();
34+
add_action( 'plugins_loaded', array( $this, 'check_dependencies' ) );
3535
}
3636

3737
/**
@@ -45,11 +45,11 @@ function init() {
4545
/**
4646
* Makes sure WooCommerce is installed and up to date.
4747
*/
48-
private function check_dependencies() {
49-
if ( ! class_exists( 'woocommerce' ) || ! version_compare(
48+
public function check_dependencies() {
49+
if ( ! class_exists( 'woocommerce' ) || version_compare(
5050
get_option( 'woocommerce_db_version' ),
5151
WC_API_Dev::WC_MIN_VERSION,
52-
'>='
52+
'<='
5353
) ) {
5454
add_action( 'admin_notices', array( $this, 'dependency_notice' ) );
5555
}

0 commit comments

Comments
 (0)