Adding Variable Data to URL for QR Codes

Hi, 

How do I add a variable to the hard coded URL so the generated URL looks like "https://www.domain.com/products/1400012/main.html"  Note that the variable here is "1400012", representing a folder with everything before it and everything after is static info and repeated.  I need to build the URL using the variable and static data as it is merged.

The idea here is to generate a QR code for each product that would land the user on that product's page.

Thanks,

Stanley