saleor-dashboard/cypress/apiRequests/storeFront/ProductDetails.js

38 lines
673 B
JavaScript
Raw Normal View History

export function getProductDetails(productId, channelId) {
const query = `fragment BasicProductFields on Product {
id
name
}
fragment Price on TaxedMoney {
gross {
amount
currency
}
}
fragment ProductVariantFields on ProductVariant {
id
sku
name
pricing {
price {
...Price
2021-02-25 09:51:52 +00:00
}
}
}
query ProductDetails{
product(id: "${productId}", channel: "${channelId}") {
...BasicProductFields
variants {
...ProductVariantFields
2021-02-25 09:51:52 +00:00
}
isAvailable
isAvailableForPurchase
availableForPurchase
2021-02-25 09:51:52 +00:00
}
}`;
return cy.sendRequestWithQuery(query, "token");
}