Woocommerce cart shortcode

I can’t seem to find anywhere the old resource where you could display the shortcode for the items in the cart, and the amount. I’m using Pro header, and the ‘add woocommerce to header’ only works in the regular header editor. How can I use it in the Pro header builder? Thanks!

Hi @jrhager84,

Thank you for reaching out to us. In header builder, you can do this with Cart Modal element. First add the Cart Modal element in your header and now to display the total amount along with the cart icon, you can simply enable the Text Setup and in Primary Text field using Dynamic Content feature (click on the icon in the Primary Text field) choose Cart Total

Or you can simply paste the following code in the Primary Text field:

{{dc:woocommerce:cart_total}}

To learn more about Dynamic Content please see https://theme.co/docs/work-with-dynamic-content

Hope this helps!

This is a TOTAL game-changer. I didn’t realize you guys added dynamic content like this. This is AMAZING!

Yes, it is.
If you need anything else we can help you with, don’t hesitate to open another thread.

Do you guys support conditionals yet? like say sensing if the user is logged in?

Hello @jrhager84,

There is no conditional statements for the dynamic contents yet.

Regards.

But in theory if I had an ACF conditional, I could set it to return empty if the condition isn’t fulfilled, no?

Hello @jrhager84,

The {{dc:woocommerce:cart_total}} will display whatever is in the cart total. There is none, a 0 or empty could display.

Regards.

I was just extrapolating to other things I could think of. Just getting a feel for what’s possible. Thanks!

You’re welcome, @jrhager84.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.