Equivalent tags in Treepl from BC

Hi Treepl community, just curious, I have this .tpl file coming from BC with the code:

 {tag_itemCount}

I was wondering what the equivalent tags are in Treepl for the {tag_cartURL} and {tag_itemCount} ?
I hope that makes sense?

Thanks in advance

Hi @patmacy

The Shopping Cart URL will always just be /shopping_cart so you can just hard-code that one.

For the item count, within your shopping cart preview layout, would be:
{{this.totalItemsCount}}
but if you are displaying this outside of your shopping cart preview layout, you would access it via the collection variable that’s set on your shopping_cart component tag, which is likely:
{{shoppingCartData.totalItemsCount}}

See the shopping_cart component docs here for more info:

If you are trying to replicate the cart preview/summary section, ie:
image
You can use the shopping_cart component directly in its place:
{% component type:"shopping_cart" %}

Hi Adam,

Thanks for the quick reply, much appreciated. Basically I am just aiming to create a little shopping icon (that usually sits top right on a site as you’d know) with the number of items sitting in the cart. So I am I understanding you right, it would be - {{shoppingCartData.totalItemsCount}} ? That would basically replace the {tag_itemCount} from BC.

Hope you’re staying safe and well on the Central Coast!

Yes, staying safe here, thanks :slight_smile:

So for that tag to work on its own you first need the shopping_cart component calling the Shopping Cart data somewhere above the tag (ie: in your site template), like this:

{% component type:"shopping_cart", layout: "", collectionVariable: "shoppingCartData" %}

and then below it somewhere, the tag:

{{shoppingCartData.totalItemsCount}}

That’s good to hear!

Thanks very much for that Adam, much appreciated. Does it sit in a script tag or does Treepl just read it as is?

Thanks again,

Pat

Just as is. Much the same as BC tags.

Great, thanks again Adam, have a good night mate!

Hey Adam, just letting you know, that worked, so thanks very much - https://brilliant_food.treepl.co/ .
Unfortunately for some reason, the whole treePL shopping cart does not work for me, even after setting up a duplicate site, that wasn’t starting from the files created from the BC to Treepl app (that was a waste of money). But still no luck, have you ever had trouble with Treepl’s shopping cart just not working, even in it’s default workflow?