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

#   Add stock status to the customer's confirmation email

##

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

Less More

- Posts: 256
- Thank you received: 2
-
-

9 years 4 months ago [\#272828](#272828) by [dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile")  *[Add stock status to the customer's confirmation email](/forum/35-orders-management/890900-add-stock-status-to-the-customers-confirmation-email#272828 "-- url of the page with the problem -- :   charnwood.net  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2  Hi, Our client wants the customer's confirmation email to also include the current stock (plus some custom PHP code that we've put in to give customer's a little information about the stock level).  Where would we need to put this code to make it appear under each product listing in the email? (I've attached a screenshot to help illustrate what it is we're trying to achieve)")* was created by *[dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile")*

-- url of the page with the problem -- : [ charnwood.net](http://charnwood.net)
-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.2

Hi, Our client wants the customer's confirmation email to also include the current stock (plus some custom PHP code that we've put in to give customer's a little information about the stock level).

Where would we need to put this code to make it appear under each product listing in the email? (I've attached a screenshot to help illustrate what it is we're trying to achieve)
[ ![ScreenShot2017-06-27at16.39.48.png](/forum/attachment/38927) ](/forum/attachment/38927 "...at16.39.48.png")

- [ ![ScreenShot2017-06-27at16.39.48.png](/forum/attachment/38927) ](/forum/attachment/38927 "...at16.39.48.png") [ ](/forum/attachment/38927?download=1 "...at16.39.48.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MDkwMC1hZGQtc3RvY2stc3RhdHVzLXRvLXRoZS1jdXN0b21lcnMtY29uZmlybWF0aW9uLWVtYWlsP3RtcGw9bWFya2Rvd24=) 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: 86583
- Thank you received: 14324
-
-

9 years 4 months ago [\#272855](#272855) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add stock status to the customer's confirmation email](/forum/35-orders-management/890900-add-stock-status-to-the-customers-confirmation-email#272855 "-- url of the page with the problem -- :   charnwood.net  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2  Hi, Our client wants the customer's confirmation email to also include the current stock (plus some custom PHP code that we've put in to give customer's a little information about the stock level).  Where would we need to put this code to make it appear under each product listing in the email? (I've attached a screenshot to help illustrate what it is we're trying to achieve)")*

Hi,

That's actually quite easy to do.
Edit the email via the menu Display&gt;Emails.
There, if you just want to add text and the stock level, you can add such text in the HTML version: Code:

Stock for that product: {LINEVAR:product.product_quantity}

after for example the tag:
{LINEVAR:PRODUCT_DETAILS}

If you want to add custom PHP there, you can write it there inside PHP tags.
For example: Code:

Stock for that product: {LINEVAR:product.product_quantity}&lt;?php echo 'test'; ?&gt;

Otherwise, for more complex modifications, you can also add custom code in the preload of the email.

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

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

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

Less More

- Posts: 256
- Thank you received: 2
-
-

9 years 4 months ago -  9 years 4 months ago [\#272866](#272866) by [dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile")  Replied by *[dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile")* on topic *[Add stock status to the customer's confirmation email](/forum/35-orders-management/890900-add-stock-status-to-the-customers-confirmation-email#272866 "-- url of the page with the problem -- :   charnwood.net  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2  Hi, Our client wants the customer's confirmation email to also include the current stock (plus some custom PHP code that we've put in to give customer's a little information about the stock level).  Where would we need to put this code to make it appear under each product listing in the email? (I've attached a screenshot to help illustrate what it is we're trying to achieve)")*

Hi Nicolas,
Thanks for this, it's worked perfectly for adding the stock to the email. I'm struggling with the PHP code though.

The code we have calls in a custom field we've made called "product_back_in_stock". The code looks like this: Code:

&lt;?php if ($this-&gt;row-&gt;product_quantity == 0 &amp;&amp; $this-&gt;element-&gt;product_back_in_stock) { echo "&lt;strong&gt;Product currently out of stock, back in stock: &lt;/strong&gt;"; echo $this-&gt;element-&gt;product_back_in_stock; } ?&gt;

Is it possible to call in custom fields to the email? If so, how would we do this?

Last edit: 9 years 4 months ago by [dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzM1LW9yZGVycy1tYW5hZ2VtZW50Lzg5MDkwMC1hZGQtc3RvY2stc3RhdHVzLXRvLXRoZS1jdXN0b21lcnMtY29uZmlybWF0aW9uLWVtYWlsP3RtcGw9bWFya2Rvd24=) 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: 86583
- Thank you received: 14324
-
-

9 years 4 months ago [\#272875](#272875) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add stock status to the customer's confirmation email](/forum/35-orders-management/890900-add-stock-status-to-the-customers-confirmation-email#272875 "-- url of the page with the problem -- :   charnwood.net  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2  Hi, Our client wants the customer's confirmation email to also include the current stock (plus some custom PHP code that we've put in to give customer's a little information about the stock level).  Where would we need to put this code to make it appear under each product listing in the email? (I've attached a screenshot to help illustrate what it is we're trying to achieve)")*

Hi,

The order data is stored in the variable $data in the emails.
You can look in the preload on how the data is used to fill the tags that are used in the HTML version.
Here is a snippet: Code:

foreach($data-&gt;cart-&gt;products as $item) { if($group &amp;&amp; $item-&gt;order_product_option_parent_id) continue; $product = @$productClass-&gt;all_products[$item-&gt;product_id]; $cartProduct = array( 'PRODUCT_CODE' =&gt; $item-&gt;order_product_code, 'PRODUCT_QUANTITY' =&gt; $item-&gt;order_product_quantity, 'PRODUCT_IMG' =&gt; '', 'item' =&gt; $item, 'product' =&gt; $product, );

you can see that the data of the product (and the custom product fields) are available there in $product so you can add your HTML to an entry in $cartProduct to create your own tag.

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

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

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

Less More

- Posts: 256
- Thank you received: 2
-
-

9 years 4 months ago [\#273065](#273065) by [dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile")  Replied by *[dancingkazzaf](/forum/user/31984-dancingkazzaf "View dancingkazzaf's Profile")* on topic *[Add stock status to the customer's confirmation email](/forum/35-orders-management/890900-add-stock-status-to-the-customers-confirmation-email#273065 "-- url of the page with the problem -- :   charnwood.net  -- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.2  Hi, Our client wants the customer's confirmation email to also include the current stock (plus some custom PHP code that we've put in to give customer's a little information about the stock level).  Where would we need to put this code to make it appear under each product listing in the email? (I've attached a screenshot to help illustrate what it is we're trying to achieve)")*

Thank you for your help Nicolas, i've got it working now ![:)](/media/kunena/emoticons/3.png ":)")

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

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