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

#   Different Email To Customer Depending on Order

##

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

Less More

- Posts: 181
- Thank you received: 28
-
-

4 months 2 days ago -  3 months 3 weeks ago [\#372514](#372514) by [yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")  *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#372514 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")* was created by *[yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")*

-- HikaShop version -- : 6.5.0 [2605281459]
-- Joomla version -- : 6.1.1
-- PHP version -- : 8.4.22

- We are selling physical products and as well a digital product.
- All orders require registration
- We are using HikaShop Tags to hide content from those who haven't paid for the digital items
- Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the "hidden" menu item for them to access a login form redirecting them to the "hidden" page

Possible?

Last edit: 3 months 3 weeks ago by [yerg55](/forum/user/60833-yerg55 "View yerg55's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkxMDY1Mi1kaWZmZXJlbnQtZW1haWwtdG8tY3VzdG9tZXItZGVwZW5kaW5nLW9uLW9yZGVyP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14292
-
-

4 months 2 days ago [\#372522](#372522) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#372522 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")*

Hi,

Yes, this is possible. Your order confirmation email is a PHP template, and inside it you have the full list of the products that were purchased, so you can show an extra block (your login / hidden menu link) only when the order contains the digital item, and hide it for orders that are physical only.

In your HikaShop backend go to System &gt; Emails and open the email your customers receive: the "Order creation notification", and/or the "Order status notification" if you would rather reveal the access only once the order is confirmed and paid. Whatever you save there is kept as an update safe override, so a HikaShop update will not overwrite it.

At the spot in the body where you want the link to appear, add this block and set your digital product id(s):
Code:

&lt;?php $digitalProductIds = array(12, 34); // put your digital product id(s) here $hasDigital = false; foreach($data-&gt;cart-&gt;products as $item) { if(in_array($item-&gt;product_id, $digitalProductIds)) { $hasDigital = true; break; } } if($hasDigital) { echo '&lt;p&gt;&lt;a href="'.HIKASHOP_LIVE.'index.php?Itemid=123"&gt;Access your content here&lt;/a&gt;&lt;/p&gt;'; } ?&gt;

Replace 12, 34 with the id(s) of your digital product(s) (you see them in the ID column of the Products listing), and Itemid=123 with the id of your hidden menu item. Customers who bought only physical products will not see the block; anyone who bought the digital item, alone or together with physical products, will get the link.

If you have many digital products and would rather not maintain a list of ids, you can rearrange the code to use a custom product field, or something else based on how you characterize digital products in your shop.

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

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

Less More

- Posts: 181
- Thank you received: 28
-
-

3 months 3 weeks ago [\#372610](#372610) by [yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")  Replied by *[yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")* on topic *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#372610 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")*

Thanks Nicolas

That's all functioning correctly
Emails coming through as expected

I'll post another Item to keep this one focused for others

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

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

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

Less More

- Posts: 181
- Thank you received: 28
-
-

2 months 1 week ago [\#373204](#373204) by [yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")  Replied by *[yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")* on topic *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#373204 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")*

Not sure why but what worked now fails.

The details in the email template don't appear at all.
The email received is perfect but not this
Updates changed anything?
Code:

&lt;?php $digitalProductIds = array(21); // put your digital product id(s) here $hasDigital = false; foreach($data-&gt;cart-&gt;products as $item) { if(in_array($item-&gt;product_id, $digitalProductIds)) { $hasDigital = true; break; } } if($hasDigital) { echo '&lt;p&gt;&lt;a href="'.HIKASHOP_LIVE.'/10-videos-and-recipes"&gt;Access your Recipes and Videos Here&lt;/a&gt;&lt;/p&gt;'; } ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkxMDY1Mi1kaWZmZXJlbnQtZW1haWwtdG8tY3VzdG9tZXItZGVwZW5kaW5nLW9uLW9yZGVyP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14292
-
-

2 months 1 week ago [\#373207](#373207) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#373207 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")*

Hi,

Nothing changed on that side in the recent versions: the HTML section of the order creation notification is still plain PHP, and I've just run your exact code on a 6.6.0 test site, the link comes out in the email as expected.

So it's more likely one of these two:

1. The code is no longer in the email. Go to System &gt; Emails, open "Order creation notification" and check the HTML section. Changing the "template" setting of the email, or clicking the restore/reset button, drops your customization back to the default file.

2. The product id doesn't match anymore. If product 21 has variants, the order line stores the id of the variant that was bought, not 21, so the test never matches. This version handles both:
Code:

&lt;?php $digitalProductIds = array(21); $hasDigital = false; foreach($data-&gt;cart-&gt;products as $item) { $ids = array((int)$item-&gt;product_id); $p = @$productClass-&gt;all_products[$item-&gt;product_id]; if(!empty($p-&gt;product_parent_id)) $ids[] = (int)$p-&gt;product_parent_id; if(array_intersect($ids, $digitalProductIds)) { $hasDigital = true; break; } } if($hasDigital) { echo '&lt;p&gt;&lt;a href="'.HIKASHOP_LIVE.'10-videos-and-recipes"&gt;Access your Recipes and Videos Here&lt;/a&gt;&lt;/p&gt;'; } ?&gt;

Note that I also removed the slash after HIKASHOP_LIVE, which already ends with one.

To see which ids the email actually gets, add this line temporarily just before the "if($hasDigital)" and place a test order:
Code:

echo '&lt;p&gt;ids: '.implode(',', array_map(function($i){ return $i-&gt;product_id; }, $data-&gt;cart-&gt;products)).'&lt;/p&gt;';

Could you also confirm the HikaShop version you're now running? It's displayed at the bottom right of your HikaShop backend.

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

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

Less More

- Posts: 181
- Thank you received: 28
-
-

2 months 6 days ago [\#373262](#373262) by [yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")  Replied by *[yerg55](/forum/user/60833-yerg55 "View yerg55's Profile")* on topic *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#373262 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")*

Updated the code as provided including the echo.
Nothing achieved at all
![:(](/media/kunena/emoticons/22.png ":(")

HikaShop Business 6.6.0 [2608311657]

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkxMDY1Mi1kaWZmZXJlbnQtZW1haWwtdG8tY3VzdG9tZXItZGVwZW5kaW5nLW9uLW9yZGVyP3RtcGw9bWFya2Rvd24=) 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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86358
- Thank you received: 14292
-
-

2 months 5 days ago [\#373271](#373271) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Different Email To Customer Depending on Order](/forum/27-checkout/910652-different-email-to-customer-depending-on-order#373271 "-- HikaShop version -- : 6.5.0 &#91;2605281459&#93; -- Joomla version -- : 6.1.1 -- PHP version -- : 8.4.22  &#42; We are selling physical products and as well a digital product.  &#42; All orders require registration  &#42; We are using HikaShop Tags to hide content from those who haven't paid for the digital items  &#42; Now looking to send, in the order confirmation email, to anyone purchasing the digital item or both physical/digital a different email confirmation to those who only purchased the physical products. We are looking to include the link to the &quot;hidden&quot; menu item for them to access a login form redirecting them to the &quot;hidden&quot; page  Possible?")*

Hi,

I looked into it again today, and tried to reproduce the problem on my end, but the custom code works fine in all my tests with HikaShop 6.6.0.
The problem is elsewhere.
There is some information you didn't provide (or missed) about the situation. For example, if you're looking at another email than the one you modified. Or if you have a specific setup with products I didn't thought about.
I guess the best would be for me to directly look in your backend in order to better understand the situation.
Could you provide a backend access via our contact form ?
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0LzkxMDY1Mi1kaWZmZXJlbnQtZW1haWwtdG8tY3VzdG9tZXItZGVwZW5kaW5nLW9uLW9yZGVyP3RtcGw9bWFya2Rvd24=) 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.057 seconds

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