Product
Get Product by Handle
GET /ajax/product?handle=product-handle
Resolve Variant by Options
POST /ajax/product/resolve-variant-by-options
{
"productId": "69651f5119d6eec96d853b31",
"options": [
"6880cc46cd6444e8a5b907f9",
"69721f9a5d1dd7f38b328095"
],
"quantity": 4
}
JavaScript Example
async function getProduct(handle) {
const res = await fetch(`/ajax/product?handle=${handle}`);
return res.json();
}
async function getVariant(productId, selectedOptions, quantity = 1) {
const res = await fetch('/ajax/product/resolve-variant-by-options', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
productId,
options: selectedOptions,
quantity
})
});
return res.json();
}