When the items are not stacked up it will not remove but if it stacked it will remove

Hi, so I’m working on this project and then I notice that if the required items are not stacked up the required items will not remove and still gives the item they craft, but if the items are stacked up the required items will be removed, please see this video

I’m worried that some of the players might abuse it

See my server-side code:

The inventory i use is : lj-inventory
My framework is : qb-core

firstly you should have it check for the number of items for both the lettuce and the buns like you did for the meat and oil. if it doesnt pass that check it wouldnt continue.

secondly i believe the removeitem function does not combine the amount of items in different stacks and that function isnt running because there isnt enough in that stack

so, they should stack the item? but when i stack up different quality it doesn’t stack up like you see at 39sec - 41sec at the video

unless you change the function it will only look at that one stack,

the stacking of items of different qualities is something that i myself is trying to solve

what function should i change?