Hi, @mmczaplinski
Until now, its a proof of concept, and I am taking advantage to learn React and Frontity.
I think Woocommerce is an excellent opportunity to apply the framework.
Soon I will include news, such as variable products and different payment gateways
I just updated the code on my local. Absolutely AWESOME. Orders work perfectly! I just want to add Stripe to my test frontity build to actually grab the payment before sending the order to wordpress and itās ready for a basic live woocommerce store.
This use case is genuinely exciting. Woocommerce is a monster for CPU with all its admin ajax, cart refresh fragments, uncached logged in user sessions, etc.
Offloading that intensive part of the store to Frontity would save someone thousands, even tens of thousands in hardware costs at scale.
Really incredible work @vscopise!
Hi @mmczaplinski !
I have a question that I would like to share:
To handle variable products I have a āvariationsā field:
https://wp.laotramirada.com.uy/wp-json/wp/v2/product/516
and I also have an endpoint to get each variation:
https://wp.laotramirada.com.uy/wp-json/wp/v2/product/516/variation/529
I would need to create a form to choose the desired variation and thus obtain its price, its description, its image, etc.
Hi @mmczaplinski !
In this example you have a Typical variable product, with 2 variations: size and colour.
In the product endpoint the diferents variation idās could be obtain and thereās another endpoint to obtain the variation itself.
I would like to build a form that allows choosing between the different variations, as you can see in the Woocommerce Storefront theme.
Thanks !!
Hey @vscopise !
Do you have an example of the code that you are using to try to accomplish what youāve described? Can you describe the approach(es) that you have tried?
Are there any errors that you are facing?
Hi @mmczaplinski !
I guess I need a handler first to get all the variationās product and then add them to the state
the endpoint could be:
product/${product.id}/variation/${variation}
2 parameters, how should it be?
After that in the Variation Component I should build the form based on the different variations
Uhm, interesting. The WP sites is not working right now, but are variations included if you use _embed=true
in the request or you have to fetch them in a separate request?
Hi, @luisherranz, they are separated request, one fetch for the product and other for the variation
/wp-json/wp/v2/product/516
/wp-json/wp/v2/product/516/variation/529
Ok, then I guess you need to do an additional request, yes.
Does the URL /wp-json/wp/v2/product/516/variation
fetch all the variations?
Hi @luisherranz, Iāve update de WC Plugin in https://github.com/vscopise/pxe-wc-api-rest to include all the variations.
The endpoint would be
/wp-json/wp/v2/product/<product-id>/variations
It is also possible to obtain the individual variation:
/wp-json/wp/v2/product/<product-id>/variation/<variation-id>