How to get only the Base Products in a list?

products

#1

Hi,

I use variations, which means after calling the “products/id/build” I get a lot more products.

How can I now get only the base Product? I thought I can use the parameter “base_id” but it’s not in the response.

Any other way to filter out child products as I don’t want them to appear in searches, etc?

Thanks a lot.

#Dom


#2

Hi Dom,

The build endpoint builds your child products - that is all the combinations of each variation option.

These child products should not being showing up in searches - only the base product should do that (if this is not the case please file a ticket at our support desk).

You then get your product via /v2/products/:id - where :id is the base product ID (you can get full details of the child product via this endpoint by substituting the relevant ID)- within the meta property of the response you should get information on variations AND a matrix of the options with child product ID mapped.

Any further questions do not hesitate to ask.

Ian


#3

Thanks for the answer. Just to clarify:

curl -X GET https://api.moltin.com/v2/products \
      -H "Authorization: Bearer XXXX"

…should only give me base products but no child products?


#4

As @dom saying I also get all the child products using the products endpoint instead of only retrieving the base product


#5

Hi, that seems to be a bug.

Possible solution: When you request all products of a category then it works and you only get the base products.

Maybe that helps.

Best
#Dom


#6

At the moment we treat base products and child products the same, so you’ll get both products in listings. We plan on removing child products from listings once it is easier to retrieve child products on their own (currently the only way to get the child products of a specific base product is to use the variation_matrix).


#7

Have you just updated that? My client’s shop just broke and it seems like when fetching products Moltin now only returns base products. The dashboard acts very similar.


#8

Hey @wyte wer’e looking into this now


#9

A little more information:

The dashboard’s “products” site contains 21 pages. All of them were filled with 6 “products” for one product. 5 variation products and the base product. Now if I visit the products site I still see the pager for 21 pages, though only the first 3 ones are filled with all the base products. The other pages showed “No Products”.

EDIT: As of writing this I just saw that it now works as expected. Thank you for the quick support!


#10

Yeah we noticed an unscheduled change leaked out. Apologies thank you for the quick response!


#11

Thanks for the incredible support! I don’t know many companies which have such great support. Moltin really turned out to be my go-to for online shops. Every time a developer friend of mine asks me about creating an online shop I recommend Moltin.

Thank you! :grin: