This error pops up when I delete an item from my cart

this error comes when i remove an item from my cart
<?php

                            if (in_array($item['item_id'], $Cart->getCartId($product->getData('cart')))){
                                echo '<button type="submit" disabled class="btn btn-success font-size-12">In the Basket</button>';
                            }else{
                                echo '<button type="submit" name="top_sale_submit" class="btn btn-warning font-size-12">Add to Basket</button>';
                            }
                            ?>

this is the code mentioned in the error. please help me

The function in_array expects the second argument to be an array. That code above is not returning an array; it’s returning null. getCartId doesn’t look like it’s supposed to return an array of ids, which I’m guessing is what you’re after; you need to take a look at the documentation of whatever you’re working with to find the right way to get those ids.

how do i initialise the array? or any code to add so that it doesn’t come up again …

Sponsor our Newsletter | Privacy Policy | Terms of Service