• Hello there!

    I have a custom php page on my site. I’m trying to initiate woocommerce global, and access cart items from there (this is obviously NOT in functions.php). But I get a 500 error everytime it runs. Code:

    global $woocommerce;
    $items = $woocommerce->cart->get_cart();

    foreach($items as $item => $values) {
    $cartartid = $values[‘sg_artid’];
    $cartproductid = $values[‘product_id’];
    if($cartproductid == “422” && $cartartid == $row[‘zzid’]) {
    $tilewall = 0;
    }
    }

    Is this possible to do and if so, what am I missing??

    Thanks so much!

The topic ‘Retrieve cart items from a different php page’ is closed to new replies.