How to base on Product handle to retriever all variant ID of option1

Hi @namphan ,
Tks for your help first. Btw I have tried it but unluck and nothing to return. I add 2 debug console.log as below and nothing captured. If something wrong with this code?

document.addEventListener(‘DOMContentLoaded’, function() {
async function handleProductLinkClick(event) {
const productHandle = this.getAttribute(‘data-selected-product-handle’);
const data = await getData(productHandle);
console.log(‘Shopify product:’, data);
}
function getData(handle) {
const data = new Promise(async (resolve, reject) => {
const response = await fetch(/products/${handle}.js);
console.log(‘Shopify response:’, response);
if (response.ok) {
const responseAsJson = await response.json();
resolve(responseAsJson);
} else {
reject(handle);
}
});
return data;
}
}