Shopify themes, liquid, logos, and UX
Hey, I want to fetch bookbinding information using Google Book api and ISBN meta field in product page
.
Check snippet code
{% comment %}
This is a Liquid snippet for Shopify.
It renders JavaScript code to fetch book binding information using the Google Books API.
{% endcomment %}
{% assign isbn = product.metafields.Neato.ISBN13 %}
<script>
// Initialize ISBN variable with the value from product metafields
const isbn = "{{ isbn }}";
// Construct the API URL with the ISBN and API key
const url = `https://www.googleapis.com/books/v1/volumes?q=isbn:${isbn}&key=AIzaSyAYWPf8pYcpd2H_-YWTK79F4b8kTRZMEx8`;
// Make a GET request to the Google Books API
fetch(url)
.then(response => response.json())
.then(data => {
// Parse the response and extract book binding information
const book = data.items[0]; // Assuming the first item is the desired book
const binding = book.volumeInfo.printType; // Extracting binding info, assuming printType indicates the binding
// Display book binding information
console.log("Book Binding:", binding);
})
.catch(error => {
console.error('Error fetching book binding:', error);
});
</script>
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024