I have a hook that shows a toggle and message in checkout_confirmation.php above the finalise button, but it does not look the same as all other toggles in the site. A.I. has tried to help, but failed, so I am hoping someone here may be able to help get the toggle to look and work the same as all the others i.e. show a red border before being switched, and then show green border and infill once toggled. This is the hook code
14Steve14 wrote: ↑Sun Jun 21, 2026 11:25 am
I have a hook that shows a toggle and message in checkout_confirmation.php above the finalise button, but it does not look the same as all other toggles in the site. A.I. has tried to help, but failed, so I am hoping someone here may be able to help get the toggle to look and work the same as all the others i.e. show a red border before being switched, and then show green border and infill once toggled. This is the hook code
14Steve14 wrote: ↑Sun Jun 21, 2026 11:25 am
I have a hook that shows a toggle and message in checkout_confirmation.php above the finalise button, but it does not look the same as all other toggles in the site. A.I. has tried to help, but failed, so I am hoping someone here may be able to help get the toggle to look and work the same as all the others i.e. show a red border before being switched, and then show green border and infill once toggled. This is the hook code
const MODULE_CHECKOUT_CONFIRMATION_DIGITAL_WAIVER_TITLE = 'Digital Content Delivery Terms';
const MODULE_CHECKOUT_CONFIRMATION_DIGITAL_WAIVER_TEXT = 'I explicitly consent to the immediate delivery of this digital content and acknowledge that I will lose my 14-day statutory right of withdrawal once the download starts.';
Just created an image which may make things clearer by what I mean when the two toggles are different.
toggles.jpg
You do not have the required permissions to view the files attached to this post.
@Omar_one Many thanks for trying to help. We have tried almost everything with this and it just stays a plain toggle. Unfortunately your suggested change made no difference, but the consolation is that the hook still worked. When I tried changing things it broke.
I think you need to
- Remove the custom validation script . Because checkout forms usually have built-in validation checks.
- adding form-switch-input to the classes, this will let native CSS engine take care of the styling.
try this
I've not looked at the code or tried it, but the first thing that came to mind is that the form in checkout_shipping "was-validated" whereas the form in checkout_confirmation is not.
I think if you make the checkout_confirmation form was-validated...by overriding the checkout_confirmation page into your template (and changing the Form appropriately), it might then be as you want it.
burt wrote: ↑Sun Jun 21, 2026 9:02 pm
I've not looked at the code or tried it, but the first thing that came to mind is that the form in checkout_shipping "was-validated" whereas the form in checkout_confirmation is not.
I think if you make the checkout_confirmation form was-validated...by overriding the checkout_confirmation page into your template (and changing the Form appropriately), it might then be as you want it.
Your hook already has a jquery script that attempts to add this class to the form. Have you checked the console for javascript errors?
If you use a template override as Gary suggests, you can lose the script section in the hook code.
Thank you to everyone for their help and guidance. With a few changes to what I had, I implemented Gary's @burt suggestion as the file had already been overwritten and everything works fine. I removed the old jquery stuff from the actual hook and everything is now working as it should.
This hook all came about as we sell downloadable products and the system needed to comply with the latest EU regulation which now requires explicit consent to remove the 14 day cooling off period when it used to rely on implied consent where we had text on the product description page.
1. You have a couple of tep_* functions which surely don't exist in recent versions of Phoenix - artifacts where AI conflates Phoenix with osCommerce. -> if that block of code invokes, it'll bomb out.
2. You don't need load_lang if the lang file is located in the correct place
In your original pasted code you had a block of javascript that added was-validated class. That probably would have worked were it not for AI conflating jQuery and javascript. Phoenix has no jQuery. Always ask AI for pure javascript.
Also, extra;
3a. Write something (date/time) to the DB to flag that the user agreed to your waiver for this Order
3b. And show this on the account_history_info page for this Order
I am not here to build for you.
I am here to build with you. Let's help each other.