MODX Community

Help with Commerce Extra

Hi,

Trying to get my head around Commerce. Finding the docs tricky to follow!
Currently I have This to show the number of items in my cart:
[[!commerce.get_cart? &toPlaceholders=cart]]
Is there a simple way to only populate the placeholder if there are items in the cart?
At the moment it always says ‘0’.

Thanks!
Andy

Please use the modmore forum or email support@modmore.com for help with Commerce - I can’t guarantee I’ll always see questions posted here.

With the call you’re posting, you’ll have access to a bunch of placeholders you can use, for example:

[[!+cart.total_quantity:gt=`0`:then=`
   <a href="[[~[[++commerce.cart_resource]]]]">View your cart ([[!+cart.total_quantity]] items)</a>
`:else=`
   <!-- cart is empty -->
`]]

OK thanks - I can’t get that working - but I’ll email instead - thanks Mark!