Fetch article data from shopify checkout page

Hi everyone,
I am currently trying to receive article data (name, quantity, size etc.) from my checkout Page. I’ve tried this:

var checkoutId = window.location.pathname.split(“/”)[2];> > fetch(“/checkouts/” + checkoutId + “.js”)> > .then(function (response) {> > return response.json();> > })> > .then(function (checkout) {> > // Access the line items in the checkout> > var lineItems = checkout.line_items;> > // Loop through the line items to get information about each item> > lineItems.forEach(function (lineItem) {> > console.log("Item id: ", lineItem.id);> > console.log("Item title: ", lineItem.title);> > console.log("Item price: ", lineItem.price);> > console.log("Item quantity: ", lineItem.quantity);> > });> > })> > .catch(function (error) {> > console.log("Error retrieving checkout: ", error);> > });

sadly it throws me this error:

Failed to load resource: the server responded with a status of 404 ()

somebody has a solution for this Issue? Thanks in advance!