Title: Call a wp e-commerce variable
Last modified: August 19, 2016

---

# Call a wp e-commerce variable

 *  Resolved [dunskii](https://wordpress.org/support/users/dunskii/)
 * (@dunskii)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/call-a-wp-e-commerce-variable/)
 * 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](https://wordpress.org/support/users/dunskii/)
 * (@dunskii)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/call-a-wp-e-commerce-variable/#post-879885)
 * 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);
 *  [bzmillerboy](https://wordpress.org/support/users/bzmillerboy/)
 * (@bzmillerboy)
 * [17 years ago](https://wordpress.org/support/topic/call-a-wp-e-commerce-variable/#post-880188)
 * I’m trying to the the same thing but I’m not fully following your code above,
   can someone help with the details? Thanks!
 * [http://brianandlindsaymiller.com/hardwalking/product](http://brianandlindsaymiller.com/hardwalking/product)
 *  [jtmink1](https://wordpress.org/support/users/jtmink1/)
 * (@jtmink1)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/call-a-wp-e-commerce-variable/#post-880209)
 * 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.

## Tags

 * [variables](https://wordpress.org/support/topic-tag/variables/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [jtmink1](https://wordpress.org/support/users/jtmink1/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/call-a-wp-e-commerce-variable/#post-880209)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
