How to get just the number of items in the user's cart?

HomeSupportImage StoreHow to get just the number of items in the user's cart?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #50641
    Dave
    Participant

    Is there any way to simply get the number of items in the user’s cart via PHP, outside of displaying the entire “store nav?”

    For example, somewhere else in our theme we would like our own message, such as, “You have 2 items in your cart.”  How to get that number?

    #50676
    Xpark Media
    Keymaster

    @Dave,

    Try this

    global $ImStore;
    $ImStore->cart['items'];

    if there cart is empty the variable will not be set.

    #50801
    Dave
    Participant

    Tried that. Unfortunately, this occurs:

    Fatal error: Cannot access private property ImStoreFront::$cart in [file]

    #50846
    Dave
    Participant

    Now works in 3.1.9. Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.