I don't understand why Best Buy would connect via optical. Your TV has 4 HDMI ports...to include HDMI Audio Return...and your soundbar also supports HDMI. An optical cable came with the soundbar, so perhaps Best Buy thought they HAD to use it.
Besides your cable box, what else do you have connected to your TV as a video source (Roku, Blu-ray, media server, wireless streaming stick, etc)? I'm just curious if Best Buy went optical because you had no more HDMI ports on your TV available.
I don't know if using HDMI for audio would solve your problem with codes because I'm just curious. Perhaps you could call Best Buy. Before you do, however, do you have a spare HDMI cable?
If you don't want to mess with cables and Best Buy, you could try a few other things to power on/off your soundbar. I looked through the User Manual for your HW-J450 and found TV SOUNDCONNECT and BLUETOOTH POWER ON.
TV SOUNDCONNECT may only work with LG TV sets. It advises other TV brands may work, but I doubt it.
If you enable BLUETOOTH POWER ON and have paired the soundbar to your LG, the TV may turn the soundbar on/off. You may have to experiment. I'm hoping BLUETOOTH POWER ON doesn't mean your TV will then send audio data to the soundbar via wireless signal. I'd prefer a wire for audio data. It's worth a look and is on page 19 of the Manual.
I'd first update the firmware of your soundbar. You'll need a computer to download and save the firmware to a USB storage stick. Instructions to update firmware are on page 23.
If no codes work as now configured, replace optical with HDMI and code again.
If powering on/off remains a problem, check out BLUETOOTH POWER ON.
downloadcenter.samsung.com/.../HW-J450-ZA_ENG-02805A-0116.pdf