3

When working with the ProductRepository in Magento 2 and the results of the getList method what is the "best" way to add extra information to the results?

For example in the default 2.1.7 setup you will get the following data.

Array
(
    [entity_id] => 1
    [attribute_set_id] => 4
    [type_id] => simple
    [sku] => sample-product-1
    [has_options] => 0
    [required_options] => 0
    [created_at] => 2017-06-06 11:28:00
    [updated_at] => 2017-06-06 11:28:00
    [status] => 1
    [visibility] => 4
    [name] => Sample Product 1
    [meta_title] => Sample Product 1
    [meta_description] => Sample Product 1 
    [options_container] => container2
    [url_key] => sample-product-1
    [gift_message_available] => 2
    [meta_keyword] => Sample Product 1
    [price] => 2.3000
    [quantity_and_stock_status] => 1
    [tax_class_id] => 2
)

But how would you recommend retrieving the stock quantity information?

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.