Hi i'm using some velo code to conditionnaly render different style components.
On initial load the page flickers with the wrong components when my conditions hit.
Is there anyway to move the code i have in the on.Ready to be processed on the server vs the client?
I'm using the .show() .hide() expande() collapse()
Here is the function i'm running in the onReady hook.
function isInStock() { //console.log(wixWindow.rendering.env) $w('#pageApp1').getProduct() .then((product) => { if (product.price === 0) { getImages(product); $w("#box1").expand() $w("#box1").show() $w("#pageApp1").collapse() $w("#pageApp1").hide() if (product.additionalInfoSections.length > 0) { $w("#box5").expand() $w("#box5").show() } } else { $w("#box1").hide() $w("#box1").collapse(); $w("#pageApp1").expand() $w("#pageApp1").show(); } }) }
Oofta i could go on for a while,
I want to be able to build my own frontend in nextjs. A headless approach. I understand that it is already doable, but i would like to avoid the checkout, payment processing, shipping, discounts, taxes headache & utilise all the wonderful apis wix offer.
The nice thing with the storefront api, is that they handle the whole checkout process + shipping/taxes, leaving the frontend totally customizable, less bloaty :)
https://dev.wix.com/api/rest/wix-stores/carts
If we could get a little create endpoint there, that could be nice :)
Also if wix paper performance vs perceived performance (great on desktop), none of this would be necessary!
I'm sure a lot of things are in the works. Bottle in the sea.
Thats what i ended up doing. Thank you.
Set my main store app as hidden (not collapsed to avoid shifting around...) It would be nice to have access to some hook that lets the server handle this type of logic and serve the correct components right away and then cache it for future requests <3
My current implementation is most likely really bad for performance but necessary for our use case..
Oh well, one day....!
Any plans on getting something similar to the shopify storefront api live on wix?
getProduct is for use in the frontend. Here are the backend API's for reference
Is is possible to set everything to be hidden until this promise is resolved? So that nothing shows that shouldn't?