2

This question is an exact duplicate of:

In Configurable products REST API, the price response is 0, so I need to get ride of it.

I knew later that configurable products prices are displayed in the web store as the smallest price listed in its children simple products and the solution is to make custom API to loop in its related simple products and return the smallest price.

The problem is I return configurable products in many APIs (Search, List products in categories, Featured products, Latest products, ...etc), So I think it is bad practice to loop on each API to make it custom, so I had an idea which make product attribute non visible and make its value automatically read the price attribute.

Is that correct and how can I achieve that?

OR, If there is a better solution, kindly share it.

marked as duplicate by KAndy, liyakat, Prince Patel, Siarhey Uchukhlebau, Manthan Dave Aug 22 '17 at 11:06

This question was marked as an exact duplicate of an existing question.

  • Here, I am asking for a scenario . – Jsparo30 Aug 21 '17 at 5:48
0

You could create a new product attribute (of type 'Price') and use the 'after save'-event to populate it. If I'm not mistaking product attributes get included in the API response. You might have to set them to 'use in product listing'.

  • Thanks, Could you please share the code ? – Jsparo30 Aug 21 '17 at 21:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.