How to retrieve customer email after creating order - Laravel & Shopify

543 views php

When i create an order, my web-hook returns a response to my controller and below is how i retrieve the details of the order


public function getOrderDetails()
         // get the content of request body    
            $order = $request->getContent();   
            $order = json_decode($order, true);    
            $order_id = $order['number'];                 
            $order_total = $order['total_price'];

            $customer_email = $order[''];


As in my controller, i am able to retrieve the order_id, order_total but i am not able to get the email of the customer who placed the order.

What is wrong in my code ?

This is how the response looks like from Shopify


  "id": 820982911946154508,
  "email": "",
  "closed_at": null,
  "created_at": "2018-10-26T13:55:26-04:00",
  "updated_at": "2018-10-26T13:55:26-04:00",
  "number": 234,
  "note": null,
 "customer": {
    "id": 115310627314723954,
    "email": "",
    "accepts_marketing": false,
    "created_at": null,

answered question

1 Answer


You can use:

$customer_email = $order['customer']['email'];

posted this

Have an answer?


Please login first before posting an answer.