Created
May 13, 2016 04:21
-
-
Save projoomexperts/2ea9bde8c418bb85a1afa13d6120560f to your computer and use it in GitHub Desktop.
Shopify Webhook to read customer registration
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
<?php | |
$webhookContent = ""; | |
$webhook = fopen('php://input' , 'rb'); | |
while (!feof($webhook)) { | |
$webhookContent .= fread($webhook, 4096); | |
} | |
fclose($webhook); | |
error_log($webhookContent); | |
$user = json_decode($webhookContent, true); | |
if($user[note] != ''){ | |
$to = "[email protected]"; | |
$subject = "New wholesaler signed up on society-plus.com"; | |
$txt = "Hi, A new user ( Name : ". $user[first_name] . " " . $user[last_name] . " , Email : " . $user[email] . ") Just registered to the store and want to be a wholesaler. Below is his/her details ( ". $user[note] ." )"; | |
$headers = "From: [email protected]" . "\r\n" . | |
"CC: [email protected]"; | |
mail($to,$subject,$txt,$headers); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment