• Resolved inorman

    (@inorman)


    Hi, after installing the plugin setting up and enabling, I’m getting several versions of the following error on my woocommerce checkout page:

    
    Notice: length was called incorrectly. Product properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/twentyseventeen/page.php'), get_template_part, locate_template, load_template, require('/themes/twentyseventeen/template-parts/page/content-page.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, WC_Shortcodes::checkout, WC_Shortcodes::shortcode_wrapper, WC_Shortcode_Checkout::output, WC_Shortcode_Checkout::checkout, WC_Cart->calculate_totals, WC_Cart_Totals->__construct, WC_Cart_Totals->calculate, WC_Cart_Totals->calculate_shipping_totals, WC_Cart_Totals->get_shipping_from_cart, WC_Cart->calculate_shipping, WC_Shipping->calculate_shipping, WC_Shipping->calculate_shipping_for_package, WC_Shipping_Method->get_rates_for_package, USPS_Simple_Shipping_Method->calculate_shipping, USPS_Simple_Shipping_Method->getRequestsArr, WC_Abstra in /home/website/public_html/website.com/wp-includes/functions.php on line 5229

    In the interim, I’ve disabled the USPS Simple Shipping.

    Any feedback on how to correct this error?

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dan

    (@dangoodman)

    Hi,

    Thank you for the report. We’ll check this and update the plugin.

    Since it’s a notice rather than an actual error, it doesn’t affect how the plugin works. If you disable the WordPress debug mode, the message won’t appear on your checkout page.

    Is there a github repo for this? I patched it with (starting at line 145 of class-shipping-usps.php):

    // Get weight of order
                foreach ($package['contents'] as $itemId => $values) {
    
    +                $_product = $values['data'];
    +                $weight = $_product->weight;
    

    Thanks for all the work.

    • This reply was modified 4 years, 4 months ago by smolgiant.
    Thread Starter inorman

    (@inorman)

    I tried adding the lines @smolgiant suggested, but I still get the same error.

    Plugin Author Dan

    (@dangoodman)

    @smolgiant, there is no GitHub repo for the plugin. But we can include the proposed changes if you let us know more details on their purpose. For now, it’s not so clear about what problem your patch is supposed to fix? Would be great if you post details on a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Notice: length was called incorrectly.’ is closed to new replies.