1

I want to insert items in a cart using a customer token. I already found how to insert the products but it needs the SKU of the products. The problem is I can't find a way to get the product's SKU using only a customer token. I used the products-render-info API, but it doesn't give the SKU. Maybe I'm using the wrong API or the wrong parameters, this is the way I use it in postman:

GET: {{baseUrl}}/products-render-info?searchCriteria[filterGroups][0][filters][0][field]=category_id&searchCriteria[filterGroups][0][filters][0][value]={{categoryId}}&storeId={{storeId}}&currencyCode={{currencyCode}}

I use the root category: 2, the default store: 1. And the currencyCode: mxn. This API gives a lot of info but I can't get the SKU.

I tried the GET: /products?searchCriteria[filterGroups][][filters][][field]={{searchCriteria[filterGroups][][filters][][field]}}&searchCriteria[filterGroups][][filters][][value]={{searchCriteria[filterGroups][][filters][][value]}}&searchCriteria[filterGroups][][filters][][conditionType]={{searchCriteria[filterGroups][][filters][][conditionType]}}&searchCriteria[sortOrders][][field]={{searchCriteria[sortOrders][][field]}}&searchCriteria[sortOrders][][direction]={{searchCriteria[sortOrders][][direction]}}&searchCriteria[pageSize]={{searchCriteria[pageSize]}}&searchCriteria[currentPage]={{searchCriteria[currentPage]}}

API too, but it seems that it only works with an admin token. Since this is for a "customer app", I want to get the info with a customer token. I don't know if there's another way to get the SKU but I need it to add items to my cart.

Also, I took a look at swagger and it seems that it doesn't show all the customer's APIs. I used a customer API and it shows more APIs than for a guest user, but I don't know if I should trust swagger since I can't find POST: /carts/mine/items there but I can use that API using my customer token. Maybe swagger doesn't show all the APIs a customer is able to use. Because of this, I wonder if there's another API I can't see as a customer but I'm able to use to get the SKU, another way to insert a product or a way to give permissions to my customers to get the SKU using some of the APIs I wrote here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.