Sure, you can use php code in your custom templates. Just make sure your page filenames end in .php, or ask your hosting provider to setup your account to parse .htm and .html files for php commands. Then your published ShopSite pages will work with php code in them.
Yes, it's working fine if I add any page using custom template. But if I add any php code in custom template header portion it doesn't work. Can't I use any php code in creating a custom template ?