receipt revisit

I'd like to conditionally hide portions of my receipt template if there is no receipt ID, such as in the case of a browser refresh on a receipt page.

is there a parameter passed to the template that would allow me to do this? I dont mind showing my customers the receipt expired message, but I think showing the rest of the receipt template with empty/missing stuff looks ugly and I'd like to just hide it when this happens.

alternatively a javascript option where I could set the display to none would work too, just let me know if that would be possible if the template param isn't an option

thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    @freshjones,

    Good question. You could add some custom styles to your receipt to customise it as needed, you'd obviously want to it conditionally in just those cases. If you set the following within the footer textarea of the custom code configuration option - that should only execute in those instances:
    {% if context == "receipt" and transaction_id == 0 %}
    <style type="text/css">

    </style>
    {% endif %}
    That needs to be in the footer as we don't support executing Twig in the header textarea currently. If you'd prefer to keep your styles in the head - you could do that, and add a class to the body using javascript in the footer within that conditional, which your CSS can then use to be limited.
Sign In or Register to comment.