How to add Custom properties to cart permalink

Topic summary

Goal: Include a custom property (projectId) when adding multiple product variants to a Shopify cart via the cart permalink format (variant_id:quantity,variant_id:quantity).

Key update: A responder recommends not relying on the standard cart permalink for custom properties. Instead, replicate permalink behavior using Shopify’s Cart AJAX API.

Suggested approach: Pass variant IDs and quantities as URL query parameters to a custom handler or page. Parse those parameters client-side, then use Cart AJAX calls to add items to the cart along with the required attribute details (e.g., the custom property).

Reference: Shopify Cart AJAX API documentation link provided for implementation details.

Outcome/status: No built-in permalink syntax for passing custom properties was provided. The proposed solution requires a custom JavaScript implementation, so the issue remains open pending development.

Summarized with AI on January 6. AI used: gpt-5.

I hope this message finds you well. I have been utilizing the cart permalink format to add multiple product variants to the cart:https://my-shop-name.myshopify.com/cart/variant_id:quantity,variant_id:quantity

Now, I have a custom property named projectId = ------- that I would like to include in this permalink. Could you please guide me on how to pass this custom attribute in the permalink? If Shopify supports this functionality, that would be great. Otherwise, I’d appreciate any alternative solutions or options available to achieve this.

Thank you for your assistance.

3 Likes

Hi @Ab_Etemadi ,

you can create your custom function which will work similar to cart paramlink using cart ajax feature.

You need to pass variant and qty as param url and read those queries and use cart ajax code to add item into the cart along with required attribute details.

https://shopify.dev/docs/api/ajax/reference/cart