The cost of each bag of onions that was purchased by Amira given the total amount spent and the cost of cookies is $6.46.
The first step is to determine the total cost of the 7 bags of onions.
Total cost of the 7 bags of onions = total amount spent - cost of cookies
$51.40 - $6.18 = $45.22
Now, divide the total cost of the 7 bags of onions by 7.
Cost of one bag of onion = 45.22 / 7 = $6.46