Twig Rendering Issues

Hey guys,

I'm having issues with some items on my checkout re-rendering in a super funky manner. I'll whisper a short video and the store name.


  • fc_adamfc_adam FoxyCart Team

    Thanks for the video - that's super helpful.

    For the rendering issues you're seeing, I believe it's because our client-side re-rendering is using the cart include template as it's set in the admin. On server render, it is using the version you've embedded directly in the checkout template. That's why you're seeing that difference between page load and when the checkout is re-rendered. If you move any customisations specific to the checkout into the cart include template, that should get it working for you consistently. You'd just need to wrap anything that is just for the checkout in {% if context == "checkout" %}{% endif %} tags.

    As an aside, I'd recommend moving any javascript form the custom checkout fields configuration option out into the custom footer configuration. The checkout fields can be re-rendered client side which will cause the javascript to be executed multiple times leading to duplicate event handlers.

    For removing focus from the email field on page load, and keeping the customer at the top, you can use a little custom javascript like this:

    {% if context == "checkout" %}
    FC.client.on("ready.done", function() {
    {% endif %}
    Finally, in terms of the special offer class being dropped - that looks to be from your render.done event for repopulating the #special_offer_summary element. It's just outputting each element as a straight line-item, it's not outputting them with the class name. If you just call your update_offer_summary() function then instead, it should be what you expect I think.

    I hope that helps!
  • Thank you Adam. You're the best!
Sign In or Register to comment.