• Resolved bluedogranch

    (@bluedogranch)


    I’m getting a Woocommerce logged error: “CRITICAL Uncaught Error: Call to a member function get_order_number() on bool” for the line that contains $order->get_order_number();

    I know this question also involves GA Enhanced Ecomm, but is there something obviously wrong with that line?

    Thanks

    <script>
        //Get order number from localstorage
        var order_view = localStorage.getItem('order_id');
        //only send to GA if order_view is null
        if(order_view == null || order_view != '<?php echo $order->get_order_number();?>') {
    		<?php foreach ( $order->get_items() as $item ) : ?>
            ga('ec:addProduct', {
                'id': '<?php echo $item['product_id']; ?>',
                'name': '<?php echo $item['name']; ?>',
                'brand': 'The Bro Basket',
                'price': '<?php echo $item['line_subtotal']; ?>',
                'quantity': '<?php echo $item['qty']; ?>'
            });
    
    		<?php endforeach; ?>
        }
    </script>
    • This topic was modified 4 years, 10 months ago by bluedogranch.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there 👋

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    If you do require more help with the actual coding, we’d recommend you hire a developer who can take a look at this, quote you for their services and help you add this feature to your site. We’d recommend getting in touch with a web developer or one of the customisation experts listed at https://woocommerce.com/customizations/.

    Cheers.

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Uncaught Error: Call to a member function get_order_number() on bool’ is closed to new replies.