Hi,
Officially the max amount of ram is 8GB i.e. 4GB fixed + 4GB removable but if it works OK with 12GB when the charger is connected it sounds more like a battery problem than a problem with the memory.
Check the condition of the battery by creating a battery report
When you have the report compare the Design Capacity value against the Full Charge capacity value. For a good battery they are nearly the same value. You can work out as a % how good the battery still is i.e Full charge capacity value x 100 / Design capacity value
If it is determined that the battery needs replacing, find the battery model number (or Asus part number) printed on the battery and use that information when searching online for suppliers. Here's the ifixit Asus X54C Battery Replacement guide that may help.
Here's a link that will help you to find information regarding the ram in the laptop. Note: This uses the Command window which is old time computing i.e. the mouse doesn't work in the window. If you make a typing error use the backspace key to step back and delete what you have already typed in, back to the point of the error and start typing again.
The laptop uses DDR3L-1600 (PC3L-12800) SODIMM ram.
The model number of the SSD can be easily found in Device Manager > Disk drives. Once you know the model number search online using the number to find out the maker of the SSD.
To get to Device Manager in Win10/11 press the Win key + x key (both together) and click on the Device Manager link that appears in the menu box.