Request to Fix Liquid snippet : Google API

25 0 0

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 %}

  // Initialize ISBN variable with the value from product metafields
  const isbn = "{{ isbn }}";

  // Construct the API URL with the ISBN and API key
  const url = `${isbn}&key=AIzaSyAYWPf8pYcpd2H_-YWTK79F4b8kTRZMEx8`;

  // Make a GET request to the Google Books API
    .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);




Replies 0 (0)