• Resolved dfc35

    (@dfc35)


    getting errors when adding things to cart, any ideas on how to fix would be greatly appreciated. –

    Notice: get_cart was called incorrectly. Get cart should not be called before the wp_loaded action. Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /home/****/public_html/main/wp-includes/functions.php on line 3547

    Notice: get_cart was called incorrectly. Get cart should not be called before the wp_loaded action. Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /home/*****/public_html/main/wp-includes/functions.php on line 3547

    Notice: get_cart was called incorrectly. Get cart should not be called before the wp_loaded action. Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /home/****/public_html/main/wp-includes/functions.php on line 3547

    Notice: get_cart was called incorrectly. Get cart should not be called before the wp_loaded action. Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /home/****/public_html/main/wp-includes/functions.php on line 3547

    Notice: get_cart was called incorrectly. Get cart should not be called before the wp_loaded action. Please see Debugging in WordPress for more information. (This message was added in version 2.3.) in /home/****/public_html/main/wp-includes/functions.php on line 3547

    Warning: Cannot modify header information – headers already sent by (output started at /home/****/public_html/main/wp-includes/functions.php:3547) in /home/****/public_html/main/wp-includes/pluggable.php on line 1178

    https://www.ads-software.com/plugins/woocommerce/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Thread Starter dfc35

    (@dfc35)

    yes I deactivated all of them. same issue. Using Canvas Child Theme

    I do have some custom code in the functions.php, adding products on the fly and adding them to the cart.

    It seems to be an issue with this –

    $woocommerce->cart->add_to_cart( $product_ID, $quantity=1 );

    It does save the product but will not add it to the cart.

    code below –

    add_action('init', 'customcart');
    
    function customcart() {
    
      if (isset($_POST["addcustomcarts"])) {
    
        global $woocommerce;
    
        $my_post = array(
          'post_title'    => 'My post',
          'post_content'  => 'This is my post.',
          'post_status'   => 'publish',
          'post_author'   => 1,
          'post_type'     =>'product'
        );
    
        // Insert the post into the database
        $product_ID = wp_insert_post( $my_post );
    
        if ( $product_ID ){
          add_post_meta($product_ID, '_regular_price', 100 );
          add_post_meta($product_ID, '_price', 100 );
          add_post_meta($product_ID, '_stock_status', 'instock' );
    
          //Getting error on this line.
          $woocommerce->cart->add_to_cart( $product_ID, $quantity=1 );
    
          exit( wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) ) );
    
        }
    
      }
    
    }

    Hi, apparently, after I update to version 2.3.3, I cannot access the settings page , both the woocommerce jetpack settings page and the main woocommerce settings page. They just display a blank page. How do i solve this.

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    @dfc35 init is too early. Change ‘init’ to ‘wp_loaded’

    @lonk start your own thread. Hijacking others is against the forum rules. And view the sticky at the top of the forum first for debugging instructions.

    Thread Starter dfc35

    (@dfc35)

    Thank You!

    I am Getting – You do not have sufficient permissions to access this page.

    After Update… I am Unable to Logged Into My Backend Panel please HELP….

    Wow, 3 hours debugging to find out this was the problem for me too.

    Thanks for the solution, what changed that init became to early?

    One thing that made this particularly hard to debug was the fact I wasn’t getting the error message till I put a die() in the WC()->cart->add_to_cart function before the return. It was strange because it seemed to completely jump out of executing my code (even a die() right after the WC()->cart->add_to_cart call did nothing) and the page redirected without showing any errors.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘errors after update to 2.3.3’ is closed to new replies.