Fix "Live Branches" item not shown in the WooCommerce menu (#47691)

* Fix live branch menu not show up

* Add changefile(s) from automation for the following project(s): woocommerce-beta-tester

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Chi-Hsuan Huang 2024-05-22 17:56:23 +08:00 committed by GitHub
parent 313ab0eb74
commit 90432c612e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Fix "Live Branches" item not shown in the WooCommerce menu

View File

@ -15,10 +15,6 @@ class WC_Beta_Tester_Live_Branches {
* Constructor.
*/
public function __construct() {
if ( ! $this->woocommerce_is_installed() ) {
return;
}
add_action( 'admin_menu', array( $this, 'register_page' ) );
add_action( 'admin_init', array( $this, 'register_scripts' ) );
}
@ -36,6 +32,10 @@ class WC_Beta_Tester_Live_Branches {
* Register live branches scripts.
*/
public function register_scripts() {
if ( ! $this->woocommerce_is_installed() ) {
return;
}
if ( ! is_admin() ) {
return;
}
@ -65,6 +65,10 @@ class WC_Beta_Tester_Live_Branches {
* Register live branches page.
*/
public function register_page() {
if ( ! $this->woocommerce_is_installed() ) {
return;
}
if ( ! function_exists( 'wc_admin_register_page' ) ) {
return;
}