Magento2: Cannot save qty for custom product type

Created on 2 Mar 2017  路  6Comments  路  Source: magento/magento2

Steps to reproduce

  1. Create custom product type like skuitem. Example.
  2. Create skuitem product in admin.
  3. Try to set Qty to xxx.

Expected result

  1. Qty is xxx.

Actual result

  1. Qty is 0 always for custom product type (skuitem).

qty

Print request in \vendor\magento\module-catalog\Controller\Adminhtml\Product\Save.php
print_r($this->getRequest()->getParams());exit;

(
    [id] => 22423
    [type] => skuitem
    [store] => 0
    ...
    [product] => Array
        (
            [status] => 1
            [name] => Test2
            [sku] => Test2
            [price] => 50.00
            [quantity_and_stock_status] => Array
                (
                    [is_in_stock] => 1
                    [qty] => 555
                )

            [visibility] => 4
            [url_key] => test2
            [meta_title] => Test2
            [meta_keyword] => Test2
            [meta_description] => Test2 
            [options_container] => container2
            [gift_message_available] => 1
            [current_product_id] => 22423
            [stock_data] => Array
                (
                    [item_id] => 17020
                    [product_id] => 22423
                    [stock_id] => 1
                    [qty] => 0
                    [min_qty] => 0
                    [use_config_min_qty] => 1
                    ...
                    [type_id] => skuitem
                    ...
                )
            ...
        )
    ...
)

I think problem with a [stock_data][qty] => 0. In simple product [stock_data][qty] always correctly. What could be a problem?

| Q | A |
| --- | --- |
| Magento version | 2.1.5 with sample data |
| PHP version | 7 x64 |
| Operating system | Windows 10 x64 |

Format is not valid

Most helpful comment

Hi @springimport let open product_types.xml and add to node type attribute isQty="true"
Sorry for my english is not good.

All 6 comments

@springimport When you say "Try to set quantity to xxx" do you mean you literally want to display the letters xxx? I believe by default this field takes numeric characters only.

@Ctucker9233 No ;)
Xxx for example only.

Hi @springimport let open product_types.xml and add to node type attribute isQty="true"
Sorry for my english is not good.

@htmyheart Thank you very much. It working!

@htmyheart, Thank you so much. Its working like a charm. Kudos to you.

Hi @springimport let open product_types.xml and add to node type attribute isQty="true"
Sorry for my english is not good.

thanks u

Was this page helpful?
0 / 5 - 0 ratings