Hi @surreal meteor again. could you help me on this one.
I've created custom self-hosted app on wix
and then using wix-cli created and embedded script extension on it. The issue is I'm not able to fetch products using products.queryProducts()
here is the code I'm attempting:
embedded.html:
<script type="module" src="./core.js" accesstoken="true"></script>
core.js:
import { createClient } from "@wix/sdk";
import { seo } from "@wix/site-seo";
import { products } from '@wix/stores';
console.log("loading product script... test-v1");
const wixClient = createClient({
auth: site.auth(),
host: site.host({ applicationId: "<my-app-id>" }),
modules: {
seo,
products,
},
});
export const injectAccessTokenFunction = wixClient.auth.getAccessTokenInjector();
console.log("Wix Client => ", wixClient);
wixClient.products.queryProducts().find().then((productsResult) => {
console.log('Products => ', productsResult)
});
wixClient.seo.title().then((title) => {
console.log("Site title:", title);
});
this was in reference to wix-site npm docs
https://www.npmjs.com/package/@wix/site
here I was able to get the site title which is a frontend module but not the products. (I have products on my test website)