Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Woocommerce prettyphoto lightbox broken #14

Open
bassjobsen opened this issue Apr 13, 2014 · 1 comment
Open

Woocommerce prettyphoto lightbox broken #14

bassjobsen opened this issue Apr 13, 2014 · 1 comment

Comments

@bassjobsen
Copy link
Owner

When running the plugin with WooCommerce and the lightbox enabled the javascript is broken.
The error: TypeError: e(...).prettyPhoto is not a function

@bassjobsen
Copy link
Owner Author

WooCommerce initiate two script to enable the lightbox in includes/class-wc-frontend-scripts.php:

    wp_enqueue_script( 'prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array( 'jquery' ), '3.1.5', true );
        wp_enqueue_script( 'prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery' ), WC_VERSION, true );

prettyPhoto-init is not only dependent of jquery, but also of prettyPhoto. The dependency of prettyPhoto is not set.

Possible fix, add following code shown to your functions.php:

add_action( 'wp_enqueue_scripts', function() { global $wp_scripts; if ( ! empty( $wp_scripts->registered['prettyPhoto-init'] ) ) { $wp_scripts->registered['prettyPhoto-init']->deps=array('jquery','prettyPhoto'); } },99 );

bassjobsen added a commit to bassjobsen/woocommerce that referenced this issue Apr 13, 2014
See also bassjobsen/wp-defer-loading#14 prettyPhoto-init is not only dependent of jquery, but also of prettyPhoto. The dependency of prettyPhoto is not set.
mikejolley pushed a commit to woocommerce/woocommerce that referenced this issue Apr 29, 2014
See also bassjobsen/wp-defer-loading#14 prettyPhoto-init is not only dependent of jquery, but also of prettyPhoto. The dependency of prettyPhoto is not set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant