mirror of
https://ghproxy.net/https://github.com/elementor/wp2static.git
synced 2025-08-29 08:32:23 +08:00
check for Woo orders
This commit is contained in:
parent
2696802564
commit
5b57329cff
1 changed files with 5 additions and 3 deletions
|
@ -150,16 +150,18 @@ class AdminNotices {
|
|||
} elseif ( is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
|
||||
// if at least one WooCommerce order exists, don't show any notices
|
||||
global $wpdb;
|
||||
$woocommerce_orders = $wpdb->get_results(
|
||||
$table_name = $wpdb->prefix . 'wc_order_stats';
|
||||
$woocommerce_orders = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT count(*) FROM $wpdb->posts WHERE post_status = %s",
|
||||
'shop_order'
|
||||
"SELECT count(*) FROM $table_name"
|
||||
)
|
||||
);
|
||||
|
||||
if ( $woocommerce_orders ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$notice = array_merge( self::getNoticeContents( 'generic' ), $notice );
|
||||
} else {
|
||||
// if no other notices to be shown, fall back to this generic one
|
||||
$notice = array_merge( self::getNoticeContents( 'generic' ), $notice );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue