Cart and membership pass
The live cart section, the JavaScript behind its buttons, the membership pass request, and the disabled cart code that still sits beside it.
The cart page renders theme/sections/asc-new-cart-layout.liquid. Its buttons are handled by src/js/custom.js, compiled into custom.bundle.js, which loads on every page.
Which cart code is live
theme/templates/cart.json contains three sections:
| Section | State |
|---|---|
asc-new-cart-layout | Enabled. This is the cart |
asc-cart-items | Disabled. It renders snippets/camp-cart-item.liquid and snippets/asc-cart-actions.liquid |
main-cart-footer | Disabled |
snippets/asc-cart-actions.liquid is what documentation/MEMBERSHIP.md describes. A change there has no effect unless someone re-enables "ASC Items" in the theme editor.
The Dawn cart drawer renders only when the theme setting Cart type is drawer. It is currently notification, and the header links straight to /cart.
Line rendering
For each cart line, asc-new-cart-layout.liquid checks the product tags:
| Tags | Rendered as |
|---|---|
Includes sport | Camp card inside div.asc-camp.cart-item, with participant details and the membership pass link |
Includes sport and membership-pass-product | Camp card, pass link hidden and title not linked |
No sport | snippets/product-cart-item.liquid, with quantity buttons |
Each camp wrapper carries data-variant-id and data-line-item-attributes. The attributes are JSON built by hand in Liquid, so custom.js parses them with sanitizeAndParseJson, which decodes HTML entities and escapes control characters. A double quote typed into a participant text area can still make the JSON invalid.
Membership pass link
The section works out the link's state inside its line loop, then renders one a.asc-camp-login per camp. The states are in Membership passes.
Class on .asc-camp-login | Handler in custom.js |
|---|---|
use-membership-pass | Calls the pass service |
membership-pass-not-applicable | Shows a SweetAlert explaining passes only apply to ASC camps |
| Neither | Ordinary link to the login page |
data-visible='false' hides the link through CSS.
Use membership pass request
On click of .use-membership-pass:
-
Add
loadingto the closest.cart-item. -
GET {Shopify.routes.cart_url}.jsto read the carttoken. -
Build the payload:
{ "customer_id": 1234567890, "customer_email": "parent@example.com", "token": "<cart token>", "lineItem": { "variantId": "<data-variant-id>", "attributes": { "First Name": "…" } } } -
POST {window.theme.api.root}v1/customers/{customer_id}/membership-pass/usewithContent-Type: text/plainand the bodybtoa(btoa(JSON.stringify(payload))). -
On success, set the
cartcookie todata.newCartTokenfor 11 days, show "Membership Pass has been used for this booking" and reload. -
On failure, show "That didn't work..." with the service's message, then reload.
The service response is { status, message, data }. The messages a customer can see include "Pass already applied for this line item", "Line item not found in cart" and "Customer has no camp claims remaining".
btoa rejects characters above U+00FF, so a participant property containing one fails before the request is sent.
Other cart handlers in custom.js
| Selector | Action |
|---|---|
.increase-quantity, .decrease-quantity, quantity inputs | POST {cart_change_url}.js with { id, quantity }, then reload |
.remove-line-item | SweetAlert confirmation, then quantity 0 and reload |
.asc-cart-checkout-button | Handled by theme/assets/cart-layout.js, which submits the hidden #checkout button |
theme/snippets/asc-track-checkout.liquid publishes checkout_clicked through Shopify.analytics.publish when the checkout button is clicked. theme/assets/clarity-tracking.js writes clarity_uid and clarity_session_id cart attributes once per session.
Upsell
asc-new-cart-layout.liquid loops over the cart lines and keeps the last variant Upsell Product that is available and not already in the cart. The block renders when the section's Upsell Visible setting is ticked.
Pending change
Branch 96-asc-073-fx-au-memberships-revised-cart-messaging-and-info-box in the theme, with 95-asc-073-… in asc-shopify-src, rewrites the state logic in both the live section and asc-cart-actions.liquid, adds a membership-pass-no-pass class and a membership_pass.use_membership_pass_no_pass string, and updates custom.js. Rebase any cart change onto that work if it has merged.
Source map
| Concern | File |
|---|---|
| Live cart | theme/sections/asc-new-cart-layout.liquid |
| Cart CSS | src/css/new-cart-layout.css |
| Click handlers | src/js/custom.js |
| Checkout button | theme/assets/cart-layout.js, theme/snippets/asc-track-checkout.liquid |
| Wording | theme/locales/en.default.json, membership_pass.* |
| Disabled cart | theme/sections/asc-cart-items.liquid, theme/snippets/camp-cart-item.liquid, theme/snippets/asc-cart-actions.liquid |
| Pass service | asc-api-membership-pass repository, src/services/redemption.service.ts |