• Resolved dunskii

    (@dunskii)


    Hi all,
    Just wondering if there is an easy way to call wp e-commerce session variables.
    I basically want to have a real basic cart that only shows qty and total if the user isn’t on a shop page.
    cheers,
    d

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dunskii

    (@dunskii)

    Never mind I solved it. Just had to find the right bits of the shopping_cart_functions.php file
    D

    FYI (note i haven’t added shipping)
    To get QTY
    $cart = $_SESSION[‘nzshpcrt_cart’];
    $cart_count = 0;

    foreach((array)$cart as $item) {

    $cart_count += $item->quantity;

    }
    echo $cart_count;

    To get sub total
    foreach($cart as $cart_item) {

    $product_id = $cart_item->product_id;

    $quantity = $cart_item->quantity;
    $price = $quantity * calculate_product_price($product_id, $cart_item->product_variations,’stay’,$cart_item->extras);
    $total += $price;
    }
    echo nzshpcrt_currency_display(($total), 1);

    I’m trying to the the same thing but I’m not fully following your code above, can someone help with the details? Thanks!

    https://brianandlindsaymiller.com/hardwalking/product

    I believe this will give you what your looking for:

    <?php echo(wpsc_cart_total()); ?>
    <?php echo(wpsc_cart_item_count()); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Call a wp e-commerce variable’ is closed to new replies.