nuxt-shopify
nuxt-shopify copied to clipboard
Any plans for Nuxt 3 support?
Are you planning to update this module to be Nuxt 3 compatible (to use composables like useShopify, etc)?
Hey @Baroshem, that's the plan! Just need to free up some time to focus on it ✌🏻
Nuxt 3 RC2 is out with RC3 on the way. Are there any progress updates worth mentioning or perhaps an ETA?
Hi @Gomah!
Thanks for your work! Any news about updating the plugin for Nuxt3 compatibility?
Thanks! Brice
Hi Everybody,
with the help of the composition API, the shopify-buy can be integrated directly. This trick simplifies the code and no additional dependencies are needed.
const shopify = Client.buildClient({
domain: process.env.shopifyDomain,
storefrontAccessToken: process.env.shopifyAccessToken,
language: 'de-DE',
})
For migration for $shopify to a composable file, the $shopify can be wrapped with wrapProperty function.
const wrapProperty =
(property, makeComputed = true) =>
() => {
const vm = getCurrentInstance().proxy
return makeComputed ? computed(() => vm[property]) : vm[property]
}
const useShopify = wrapProperty('$shopify', false)
I performed the migration from nuxt-shopify to shopify-buy in this example.
https://github.com/naschidaniel/fly-tirol/commit/379eb797faa117cf69a8076b2da93884325fb5ee
The composable is thus nuxt3 ready
All the best,
Daniel
@Gomah, Thank you for your work. The module worked perfect before the composition API was created.
Can anyone link me to a slim example using shopify-buy with Nuxt 3?