Is it possible to transfer inventory item counts to global variables?

Is it possible to transfer inventory item counts to global variables
what i mean is if i have a global variable for wood and i pick it and it adds to the add item function of inventory then how can i transfer it to global inventory