Way to get total value of cart

Hi,

I asked the other day whether there was any code available to change the functionality of the cart to only allow customers to buy in sets of 4. I am yet to find whether I can but have come up with the solution to add a vector image over the checkout button. This way I can hide it when there are multiples of 4 in the basket.
I am hoping to find whether anyone knows a way to get the current item total/price from the cart to use as ‘var a’ below.
Any help would be much appreciated, thank you!

var a =
var num = [4, 8, 12, 16, 24];

if ( a === num) { // true
$w(“#vectorImage72”).hide();
}
else {
$w(“#vectorImage72”).show();
}
})

Hello Xenia,

As for your first point, a better way to implement that would be to use the remainder function like so:

if (a % 4 = 0) { //Checks to see if number is divisible by 4
  $w("#vectorImage72").hide(); 
} 
else { 
  $w("#vectorImage72").show();  
}

Read more about that - here.

Getting the total amount of items in the cart and getting their total cost is not available yet. Here are all the API references for working with the stores feature - here.

Best,
Majd

Thank you Majd, that’s really helpful, I’m hoping that the cart features will be implemented soon then.

Anyway, thanks again

Xenia