Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //GET CART
- $.get('/api/storefront/carts?include=', (data) => {
- console.log(data)
- });
- //POST Cart
- const body = {
- "lineItems": [{
- "quantity": 1,
- "productId": 17332,
- "listPrice": 100.00
- }]
- };
- $.post('/api/storefront/carts', (JSON.stringify(body)))
- .done((msg) => {
- //..
- })
- .fail((jqXHR, textStatus, errorThrown) => {
- console.log(jqXHR);
- console.log(textStatus);
- console.log(errorThrown);
- });
- //POST Item to Cart
- const addItem = {
- "lineItems": [{
- "quantity": 1,
- "productId": 17323,
- "listPrice": 100.00
- }]
- };
- const cartId = "CXXXXX-XXX-4510-bf2b-XXXXXXX";
- $.post(`/api/storefront/carts/${cartId}/items`, (JSON.stringify(addItem)))
- .done((msg) => {
- //..
- })
- .fail((jqXHR, textStatus, errorThrown) => {
- console.log(jqXHR);
- console.log(textStatus);
- console.log(errorThrown);
- });
Add Comment
Please, Sign In to add comment