You have two options as far as I can tell.
Programmatically determine the height of your receipt. Instead of hard-coding the configuration to '639', determine a more appropriate height for this label by multiplying the number of products by some constant. For example - if you have 3 products on your label, set the height to 3 * 100 = 300. If you have 5, set it to 5 * 100 = 500. You will have to tweak this to get a reliable length.
Use line-print mode. Instead of indicating the label-size up front, you could potentially use line-print mode to simply print one line at a time. Line print mode will cause each line of data received to be printed immediately. Instead of sending CPCL (T180 0 3 x y....), you simply send the text you want printed. Take a look here for an example on how to enable line print mode: https://km.zebra.com/kb/index?page=content&id=SO7296. You can also find more details about line print mode in section 9-1 of the CPCL manual: http://www.zebra.com/content/dam/zebra/manuals/en-us/printer/cpcl-pm-en.pdf