Reading the cart.id to pass as a parameter in a tag

Tourist
9 0 3

Hello,

I am putting some tags on my website for tracking (not facebook Pixel, Bing or GA!) and one of the parameters i need to pass through is the cart id from a user session. 

I am familiar with the liquid variables and have being using them for the rest of the tags but there does not seem to be a liquid tag available for a cart id.

My question is - Is there a way of extracting a cart ID from a user session? in order for it to be passed as a parameter 

Many Thanks

0 Likes
Shopify Expert
565 24 93

You can extract the checkout ID from the URL with Javascript.

★ ThemeUp: Nifty Upgrades for your Shopify Store ★ https://themeup.net
0 Likes
Highlighted
Tourist
9 0 3

Thanks Thomas,

Is a cart id only assigned once the checkout procedure has begun?

Is there a way you get a cart id of a cart which has not begun the checkout process, i.e just adding items onto the cart?

0 Likes
Shopify Expert
565 24 93

I'm not sure, but I think the ID is assigned the first time a cart gets submitted to checkout. Which would make sense, as the ID wouldn't be needed before then and assigning one to every cart even before going to checkout would result in tons of useless IDs being generated.

★ ThemeUp: Nifty Upgrades for your Shopify Store ★ https://themeup.net
0 Likes
Tourist
9 0 3

Makes sense.

The URL for my checkout is the following

https://beautyandseoul.co.uk/15334581/checkouts/57dsg2a5hfgd3774f2d446b80f7cf005a

I'm assuming the ID is 15334581 as this is consistent with the ID on the abandoned baskets page. Is this correct?

Cheers for your help, really appreciated

0 Likes
Shopify Expert
565 24 93

The number before /checkouts/ is the store ID and is the same for every ckeckout. The longer alphanumeric string after /checkouts/ is the checkout ID. 

★ ThemeUp: Nifty Upgrades for your Shopify Store ★ https://themeup.net
0 Likes