Get the last item added to RMS POS transaction Screen

I am creating an RMS Plugin to set the quantity of the last item added by the cashier through add item. The plugin works perfect but fails when the cashier
enter a wrong itemlookupcode, this causes the plugin to change the quantity of a previously added item. My question, How do i know that the item was added successfully so that i can update the quantity since additem hook is called even when the cashier enters none existing itemlookupcode.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

BeanSmart.com is a site by and for consumers of financial services and advice. We are not affiliated with any of the banks, financial services or software manufacturers discussed here. All logos and trade names are the property of their respective owners.

Tax and financial advice you come across on this site is freely given by your peers and professionals on their own time and out of the kindness of their hearts. We can guarantee neither accuracy of such advice nor its applicability for your situation. Simply put, you are fully responsible for the results of using information from this site in real life situations.