Created
February 8, 2024 13:36
-
-
Save elephantsneverforget/5b04475a9357bcf9e898a5d746df4fb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Replace CUSTOMERID with the specific customer id & add your api key | |
const apiUrl = 'https://example.com/admin/api/2024-01/customers/CUSTOMERID.json'; | |
async function fetchOrdersCount() { | |
const response = await fetch(apiUrl, { | |
method: 'GET', | |
headers: { 'Content-Type': 'application/json', | |
// Add your api key | |
} | |
}); | |
const data = await response.json(); | |
// Push event to CAPI | |
console.log('Orders Count:', data.customer.orders_count); | |
} | |
fetchOrdersCount(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment