Jump to content

Hook Requested on checkout page


Go to solution Solved by DennisHermannsen,

Recommended Posts

Hello,
Could someone help me create a hook on the checkout page that prevents the customer from completing the order if he filled out any of these fields (Address 1, City, State, Postal Code, and Phone Number)?

Link to comment
Share on other sites

Posted (edited)
3 hours ago, WhmTools said:

You mean prevent them from placing the order if they didn't enter Address 1, City, State, Postal Code, and Phone Number?

No, my post is correct.

I want the hook to not proceed with an order if the customer fills out any of these fields (Address 1, City, State, Postal Code, and Phone Number).
I already hide them by CSS, but some script hackers can still fill out these fields to complete fake orders.

Edited by Craft
Link to comment
Share on other sites

On 8/26/2024 at 1:32 AM, DennisHermannsen said:
<?php

add_hook('ShoppingCartValidateCheckout', 1, function($vars) {
    if (!empty($vars['address1']) || !empty($vars['city']) || !empty($vars['postcode']) || !empty($vars['phonenumber'])) {
        return ['gotcha!'];
    }
});

 

Thanks @DennisHermannsen for the hook, it solved my issue 🙂

Can we create the same hook code for the Register page?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated