Issue
I have created a Static e-commerce site using Hugo.
want to add products thro' Shopify admin, and get it reflected on my site.
I'm quite familiar with liquid templating. Kindly let me know how to achieve this?
So far,
- I have created a Shopify store, added a theme and added one product.
- I'm not looking to customize an existing theme, but completely remove that theme add my website theme in it.
Solution
You should be able to get your products using the Shopify API. This endpoint could be the one for you. From Hugo, you can then retrieve the products by getJson function with telling it the Shopify authorization header X-Shopify-Access-Token
. Like this:
{{ $data := getJSON "https://your-store.myshopify.com/admin/api/2022-01/products.json" (dict "X-Shopify-Access-Token" "your-token") }}
{{ range $data }}
{{ . }}
{{ end }}
Just make sure that you've replaced both the your-store
and your-token
strings.
Answered By - Jan Švábík Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.