---
title: "How do you force WooCommerce not to load its lightbox?"
description: "If the same thing has happened to you as happened to us, that the WooCommerce Scripts -> Enable Lightbox option, available in Settings -> General, pays you no attention whatsoever and WooCommerce carries on loading its lightbox by default alongside"
url: https://artprojectgroup.com/how-to-force-woocommerce-not-to-load-its-lightbox
date: 2013-11-28
modified: 2023-02-11
author: "Art Project Group"
image: https://artprojectgroup.com/wp-content/uploads/2023/04/woocommerce-blog.webp
categories: ["Tutorials"]
tags: ["functions.php", "Lightbox", "WooCommerce", "WordPress"]
type: post
lang: en-US
---

# How do you force WooCommerce not to load its lightbox?

If the same thing has happened to you as happened to us, that the WooCommerce *Scripts -> Enable Lightbox* option, available in *Settings -> General*, pays you no attention whatsoever and WooCommerce carries on loading its lightbox by default alongside your brand-new [FancyBox for WordPress](https://wordpress.org/plugins/fancybox-for-wordpress/), for example, we are going to give you a quick and simple solution.

To solve it and force WooCommerce not to load its lightbox, the only thing you have to do is go to our trusty *functions.php* file, which you already know is in our WordPress child theme. In it we are going to insert these lines:

Copy to clipboardSyntax Highlighter//We remove the WooCommerce default lightbox
function remove_lightbox_javascript() {
wp_dequeue_script( 'prettyPhoto' );
wp_dequeue_script( 'prettyPhoto-init' );
}
add_action( 'wp_print_scripts', 'remove_lightbox_javascript', 100 );

function remove_lightbox_css() {
wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
}
if ( ! is_admin() ) {
add_action( 'wp_print_styles', 'remove_lightbox_css', 100 );
}
And that is it, we have now forced WooCommerce not to load its particular lightbox, called prettyPhoto. Although you already know that you should only resort to brute force if the *Scripts -> Enable Lightbox* option has not worked for you.

We hope you find this simple piece of code useful and, if so, we look forward to your comments.

> Update: given that we have detected that some PHP errors and warnings were being caused in the online shop, we have updated the code to be inserted to prevent any kind of error or warning from appearing. We have also detected an error in the layout of the WooCommerce 2.1.0 administration panel that has also been solved.
