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 ...
AI crawlers can’t see structured data added with JavaScript. Use server-side rendering or static HTML for visibility. Adapting now may improve visibility in AI search engines. An investigation reveals ...