Skip to content

Commit

Permalink
load assets on onboarding only
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed May 24, 2024
1 parent 1fdde4b commit c6f2559
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ function ( $pages ) {
// load admin scripts.
add_action(
'admin_enqueue_scripts',
function () {
$this->load_scripts_styles();
function ( $hook ) {
$this->load_scripts_styles( $hook );
}
);
}
Expand All @@ -111,9 +111,11 @@ function () {
/**
* Loads and enqueues admin scripts and styles.
*
* @param string $hook The current admin page.
*
* @since 2.0.0
*/
private function load_scripts_styles() {
private function load_scripts_styles( $hook ) {
global $typenow;

if ( 'product' === $typenow ) {
Expand Down Expand Up @@ -245,7 +247,7 @@ private function load_scripts_styles() {
array(),
$asset['version'],
);
} else {
} elseif ( 'woocommerce_page_woocommerce-square-onboarding' === $hook ) {
$asset_file = WC_SQUARE_PLUGIN_PATH . 'build/onboarding.asset.php';

if ( ! file_exists( $asset_file ) ) {
Expand Down

0 comments on commit c6f2559

Please sign in to comment.