• After updating to WC 3.3, the gift card for WC plugin seems to be breaking all scripts for my site. This is causing all sorts of issues for my customers. Searching for a solution.

    Thanks

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Me too:

    Notice: Undefined index: section in …/public_html/wp-content/plugins/gift-cards-for-woocommerce/includes/class.settings.php on line 106

    Hello guys,

    I think I found the source of the problems.

    Inside the script {plugin}/includes/functions.php on line 84
    seams that WC()->cart object still don’t exists and it’s null which cause the fatal error and not loading the rest of the site content.

    Quick fix would be just to check if WC()->cart is empty before going trough foreach loop.

    Hope you can look into this before next update.

    Cheers.

    Thread Starter amiaboutique

    (@amiaboutique)

    Hi Milos!
    This is what I have for line 84:
    foreach ( WC()->cart->get_cart() as $key => $product) {

    Does that look right? If not, can I make a change to fix the issue?

    Thanks.

    Hello there.

    Basically, fix would look like this:

    ...
    $has_giftcard = "no";
    
    // Check if cart is empty before going through the loop.
    if ( empty( WC()->cart ) ) {
         return $enabled;
    }
    	
    foreach ( WC()->cart->get_cart() as $key => $product ) {
    ...

    Hope this helps.

    Milos

    Thread Starter amiaboutique

    (@amiaboutique)

    @mpetkovic

    Unfortunately, that didn’t seem to fix the problem. If you have any other ideas, let me know!

    Thanks for the quick reply!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Plugin breaking scripts on site’ is closed to new replies.