Skip to content

Commit

Permalink
fix: wp_register_script was called incorrectly and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MaferMazu committed Oct 3, 2024
1 parent 4d06642 commit a6c4216
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions includes/class-openedx-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function __construct() {
$this->define_admin_hooks();
$this->define_public_hooks();
$this->define_plugin_settings_hooks();
$this->define_enqueue_scripts();
$this->loader->add_action('admin_enqueue_scripts', $this, 'enqueue_custom_scripts');
}

/**
Expand Down Expand Up @@ -270,12 +270,12 @@ private function define_public_hooks() {
* @since 1.11.0
* @access private
*/
private function define_enqueue_scripts() {
wp_register_script( 'product-type-script', plugin_dir_url( __FILE__ ) . '../admin/js/product-type.js', array(), $this->get_version(), true );
wp_enqueue_script( 'product-type-script' );

wp_register_script( 'course-id-restriction-script', plugin_dir_url( __FILE__ ) . '../admin/js/course-id-restriction.js', array(), $this->get_version(), true );
wp_enqueue_script( 'course-id-restriction-script' );
private function enqueue_custom_scripts() {
$plugin_js_path = plugin_dir_url(__FILE__) . '../admin/js/';
$version = $this->get_version();
wp_enqueue_script('product-type-script', $plugin_js_path . 'product-type.js', array(), $version, true);
wp_enqueue_script('course-id-restriction-script', $plugin_js_path . 'course-id-restriction.js', array(), $version, true);
}

/**
Expand Down

0 comments on commit a6c4216

Please sign in to comment.