Created
October 17, 2020 16:24
-
-
Save rawars/48644f0586eec58c869371706f9201c9 to your computer and use it in GitHub Desktop.
Auto fill wordpress checkout form.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
add_filter( 'woocommerce_checkout_get_value' , 'custom_checkout_get_value', 20, 2 ); | |
function custom_checkout_get_value( $value, $imput ) { | |
// Billing first name | |
if(isset($_GET['FirstName']) && ! empty($_GET['FirstName']) && $imput == 'billing_first_name' ) | |
$value = esc_attr( $_GET['FirstName'] ); | |
// Billing last name | |
if(isset($_GET['LastName']) && ! empty($_GET['LastName']) && $imput == 'billing_last_name' ) | |
$value = esc_attr( $_GET['LastName'] ); | |
// Billing email | |
if(isset($_GET['EmailAddress']) && ! empty($_GET['EmailAddress']) && $imput == 'billing_email' ) | |
$value = sanitize_email( $_GET['EmailAddress'] ); | |
// Individual 4968 | |
// Familiar 4967 | |
return $value; | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment