Shopify / shopify.github.com

A collection of the open source projects by Shopify
https://shopify.github.io
MIT License
509 stars 113 forks source link

How to get abandoned cart data #112

Closed Soyam-Jain closed 1 year ago

Soyam-Jain commented 1 year ago

In my index.js app.get("/api/abandoned-cart", async (_req, res) => { const checkoutsData = await shopify.api.rest.AbandonedCheckout.checkouts({ session: res.locals.shopify.session,

}); res.status(200).send(checkoutsData); });

and I have created a component abandonedCart

import React, { useEffect, useState } from "react";

function AbandonedCart() { const [checkoutsData, setCheckoutsData] = useState([]);

useEffect(() => { fetch("/api/abandoned-cart") .then(response => response.json()) .then(data => { setCheckoutsData(data) console.log("data",data)}) .catch(error => console.error(error)); }, []);

return (

Abandoned Cart Data:

{JSON.stringify(checkoutsData, null, 2)}

); }

export default AbandonedCart;

the auth api I am calling is

const shopify = shopifyApp({ api: { apiVersion: LATEST_API_VERSION, restResources, billing: undefined, // or replace with billingConfig above to enable example billing }, auth: { path: "/api/auth?shop=brandgoclothe-01.myshopify.com", callbackPath: "/api/auth/callback", }, webhooks: { path: "/api/webhooks", }, // This should be replaced with your preferred storage strategy sessionStorage: new SQLiteSessionStorage(DB_PATH), });


when the api is called I am getting 503 error

I am attaching the RQ/RS of the api's

abandone a

aditional informtion is earlier I am getting shop undefined error, so I have included shop=brandgoclothe-01.myshopify.com", as query parameter in and now I am getting 503 error in both the api's.

help me to get out of this

rafaelfranca commented 1 year ago

Thank you for the issue, but this repository isn't a support channel. Please use one of the official support channels. See https://shopify.dev/ for more info