Useful snippets

    graphql fetch using multiple IDs

    2023-11-05

    fetch all related products from a list of products, and get results merged into one response!

    const GET_RELATED_PRODUCTS = `
        query getRelatedProducts($url: [String!]) {
            products(filter: { url: { in: $url } }) {
                items {
    
                }
            }
        }
    `
    

    fetching just one product's related products

    const GET_RELATED_PRODUCTS = `
        query getRelatedProducts($url: String!) {
            products(filter: { url: { eq: $url } }) {
                items {
    

    } } } `