In the Google Merchant Center structured data documentation, it says that you should add structured data to the HTML source and that it "can't be generated after a page has been loaded using ...
Google updated its documentation around its shopping related structured data warning not to generate your structured data ...