parent
8951bef0ee
commit
63dca2393c
|
@ -71,11 +71,19 @@ class WC_Data_Store {
|
|||
|
||||
if ( array_key_exists( $object_type, $this->stores ) ) {
|
||||
$store = apply_filters( 'woocommerce_' . $object_type . '_data_store', $this->stores[ $object_type ] );
|
||||
if ( ! class_exists( $store ) ) {
|
||||
throw new Exception( __( 'Invalid data store.', 'woocommerce' ) );
|
||||
if ( is_object( $store ) ) {
|
||||
if ( ! class_implements( $store, WC_Object_Data_Store_Interface::class ) ) {
|
||||
throw new Exception( __( 'Invalid data store.', 'woocommerce' ) );
|
||||
}
|
||||
$this->current_class_name = get_class( $store );
|
||||
$this->instance = $store;
|
||||
} else {
|
||||
if ( ! class_exists( $store ) ) {
|
||||
throw new Exception( __( 'Invalid data store.', 'woocommerce' ) );
|
||||
}
|
||||
$this->current_class_name = $store;
|
||||
$this->instance = new $store;
|
||||
}
|
||||
$this->current_class_name = $store;
|
||||
$this->instance = new $store;
|
||||
} else {
|
||||
throw new Exception( __( 'Invalid data store.', 'woocommerce' ) );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue