I need to update the order summary dynamically using custom JavaScript code. The functionality should include:
Removing shipping and handling charges based on specific conditions.
Adding or removing products from the order summary as needed.
Could anyone help me implement this?
Hi @Rahul_Gohil
— welcome to the Funnelish community!
You’re on the right track — what you’re trying to achieve is definitely doable with custom JavaScript, and it’s a powerful way to control the checkout experience.
Here’s a high-level approach to get you started:
Steps to Dynamic Order Summary Updates:
-
Wait for the page and order data to fully load
Use a small delay or observe when the DOM and Funnelish scripts are fully ready before manipulating anything.
-
Identify elements or data structures
Locate the DOM elements or variables Funnelish uses to render the order summary, shipping, and product items.
-
Define the condition logic
Write logic to check your specific conditions — for example, checking the cart total, a product ID, a location, or whether a promo code is applied.
-
Remove or modify shipping charges
Based on your condition, dynamically update or hide the shipping section from the summary UI.
-
Add or remove products
If you’re adding a bonus item or removing a product, update both the visual DOM and internal Funnelish cart object (if applicable).
-
Recalculate totals
Trigger an update to ensure the total reflects the changes — sometimes this involves dispatching events Funnelish listens to.
To guide you more precisely, could you share the checkout layout you’re working with or a reference funnel that shows how you’d like the order summary to behave?
That’ll help me tailor the guidance better and offer next-step suggestions!