[Skip to main content](#vessel-content)

#   Get customer email in MassAction PHP script

##

- **[Valle](/forum/user/62857-valle "View Valle's Profile")**
- [![Valle's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/62857-valle "View Valle's Profile") Topic Author
- [ Offline](/forum/user/62857-valle)

Less More

- Posts: 1
- Thank you received: 0
-
-

5 years 3 weeks ago [\#336737](#336737) by [Valle](/forum/user/62857-valle "View Valle's Profile")  *[Get customer email in MassAction PHP script](/forum/44-mass-actions/903406-get-customer-email-in-massaction-php-script#336737 "The MassAction feature is perfect for what I want to do. I want to send JSON data to my API on the status change of a specific order. So I use the MassAction tool. Everything works fine and I can...")* was created by *[Valle](/forum/user/62857-valle "View Valle's Profile")*

The MassAction feature is perfect for what I want to do. I want to send JSON data to my API on the status change of a specific order. So I use the MassAction tool. Everything works fine and I can filter for my product and trigger a PHP script. The script does what it has to.
Code:

$url = "https://xyz.test:3535/newCustomerKey"; $user = $this-&gt;get($data-&gt;order_product_name); echo $user; $curl = curl_init($url); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $headers = array( "Accept: application/json", "Content-Type: application/json", ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); $data = &lt;&lt;&lt;DATA { "key": 123, "product": "XXX", "customerEmail": "XXX" } DATA; curl_setopt($curl, CURLOPT_POSTFIELDS, $data); $resp = curl_exec($curl); curl_close($curl);

Now the problem, how can I get the email of the customer from the order? When I echo $this I got "plgSystemHikashopmassaction".
On a custom Email Template i would do something like this: $user_email = @$customer-&gt;email;
Is there any way to get the data of the order from my custom script?
For the MassAction I use the trigger After an order is changed and filter on some stuff.

Thanks a lot for the help!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDM0MDYtZ2V0LWN1c3RvbWVyLWVtYWlsLWluLW1hc3NhY3Rpb24tcGhwLXNjcmlwdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86584
- Thank you received: 14325
-
-

5 years 3 weeks ago [\#336742](#336742) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Get customer email in MassAction PHP script](/forum/44-mass-actions/903406-get-customer-email-in-massaction-php-script#336742 "The MassAction feature is perfect for what I want to do. I want to send JSON data to my API on the status change of a specific order. So I use the MassAction tool. Everything works fine and I can...")*

Hi,

You should be able to do it with something like that: Code:

$orderClass = hikashop_get('class.order'); $order = $orderClass-&gt;get({order_id}); $userClass = hikashop_get('class.user'); $user = $userClass-&gt;get($order-&gt;order_user_id); echo $user-&gt;user_email;

The following user(s) said Thank You: [aftertaf](/forum/user/13416-aftertaf "View aftertaf's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDM0MDYtZ2V0LWN1c3RvbWVyLWVtYWlsLWluLW1hc3NhY3Rpb24tcGhwLXNjcmlwdD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.068 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
