Support » Plugin: WooCommerce Side Cart (Ajax) » PHP Warning: implode(): Invalid arguments passed

  • Hi
    There is a PHP warning like shown below:
    PHP Warning: implode(): Invalid arguments passed in .../wp-content/plugins/side-cart-woocommerce/public/partials/xoo-wsc-content.php on line 115

    Looks like nothing serious but maybe would be good to fix this.

    BTW
    Great plug-in

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter jurasjo

    (@jurasjo)

    I think it is because empty array called $extra_classes. If there is no additional classes defined , the array is empty.

    I have edited line 115 in mentioned file to something like that and warning is gone but I don’t know if this is the proper way of handling it.
    <div class="xoo-wsc-product <?php if ( !empty($extra_classes) ) { echo implode(' ',$extra_classes); }; ?>">

    Everywhere where “WC()->cart->…” is called, there has to be a check if the cart is empty/null. For example:

    
    if(!is_null(WC()->cart)) {
        echo WC()->cart->get_cart_total();
        echo WC()->cart->get_cart_contents_count();
    } else { 
        echo '0';
    }
    
    • This reply was modified 1 year, 5 months ago by webastronaut.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Warning: implode(): Invalid arguments passed’ is closed to new replies.