1

I've created two custom attributes, but when i create a simple product, just saves one attribute. Using postman,the request has both attributes fields, but the response just has one. Any help is appreciated.

Color Attribute, this one works.

"is_wysiwyg_enabled": false,
"is_html_allowed_on_front": false,
"used_for_sort_by": false,
"is_filterable": true,
"is_filterable_in_search": false,
"is_used_in_grid": true,
"is_visible_in_grid": false,
"is_filterable_in_grid": true,
"position": 0,
"apply_to": [
    "simple",
    "virtual",
    "configurable"
],
"is_searchable": "1",
"is_visible_in_advanced_search": "1",
"is_comparable": "1",
"is_used_for_promo_rules": "0",
"is_visible_on_front": "0",
"used_in_product_listing": "0",
"is_visible": true,
"scope": "global",
"attribute_id": 93,
"attribute_code": "color",
"frontend_input": "select",
"entity_type_id": "4",
"is_required": false,
"options": [
    {
        "label": " ",
        "value": ""
    },
    {
        "label": "BLACK",
        "value": "5432"
    },
   
    {
        "label": "RATO",
        "value": "5442"
    },
    {
        "label": "WHITE",
        "value": "5438"
    },{
        "label": "CELESTE",
        "value": "5444"
    }
],
"is_user_defined": true,
"default_frontend_label": "Color",
"frontend_labels": [],
"backend_type": "int",
"source_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
"default_value": "5466",
"is_unique": "0",
"validation_rules": []

sizee attribute, doesn't saves.

 "is_wysiwyg_enabled": false,
"is_html_allowed_on_front": false,
"used_for_sort_by": false,
"is_filterable": true,
"is_filterable_in_search": false,
"is_used_in_grid": true,
"is_visible_in_grid": false,
"is_filterable_in_grid": true,
"position": 0,
"apply_to": [
    "simple",
    "virtual",
    "configurable"
],
"is_searchable": "1",
"is_visible_in_advanced_search": "1",
"is_comparable": "1",
"is_used_for_promo_rules": "0",
"is_visible_on_front": "0",
"used_in_product_listing": "0",
"is_visible": true,
"scope": "global",
"attribute_id": 150,
"attribute_code": "sizee",
"frontend_input": "select",
"entity_type_id": "4",
"is_required": false,
"options": [
    {
        "label": " ",
        "value": ""
    },
    {
        "label": " ",
        "value": "5489"
    },
    {
        "label": " ",
        "value": "5487"
    },
    {
        "label": " ",
        "value": "5488"
    },
    {
        "label": "28",
        "value": "5485"
    },
    {
        "label": "29",
        "value": "5486"
    },
    
    {
        "label": "34",
        "value": "5472"
    }
],
"is_user_defined": true,
"default_frontend_label": "sizee",
"frontend_labels": [],
"backend_type": "int",
"source_model": "Magento\\Eav\\Model\\Entity\\Attribute\\Source\\Table",
"default_value": "",
"is_unique": "0",
"validation_rules": []

SIMPLE PRODUCT REQUEST:

{
        "product": {
            "sku": "hudson02-CELESTE-29",
            "name": "hudson02-CELESTE-29",
            "attribute_set_id": 4,
            "price": 0,
            "status": 1,
            "visibility": 1,
            "type_id": "simple",
            "extension_attributes": {
                "website_ids": [
                    1
                ],
                "stock_item": {
                    "stock_id": 1,
                    "qty": 888,
                    "is_in_stock": true,
                    "is_qty_decimal": false,
                    "show_default_notification_message": false,
                    "use_config_min_qty": true,
                    "min_qty": 0,
                    "use_config_min_sale_qty": 1,
                    "min_sale_qty": 1,
                    "use_config_max_sale_qty": true,
                    "max_sale_qty": 10000,
                    "use_config_backorders": true,
                    "backorders": 0,
                    "use_config_notify_stock_qty": true,
                    "notify_stock_qty": 1,
                    "use_config_qty_increments": true,
                    "qty_increments": 0,
                    "use_config_enable_qty_inc": true,
                    "enable_qty_increments": false,
                    "use_config_manage_stock": true,
                    "manage_stock": true,
                    "low_stock_date": null,
                    "is_decimal_divided": false,
                    "stock_status_changed_auto": 0
                }
            },
            "product_links": [],
            "options": [],
            "media_gallery_entries": [],
            "tier_prices": [],
            "custom_attributes": [
                {
                    "attribute_code": "cnpj",
                    "value": "333"
                },
                {
                    "attribute_code": "ean",
                    "value": "hudson02-CELESTE-29"
                },
                {
                    "attribute_code": "options_container",
                    "value": "container2"
                },
                {
                    "attribute_code": "msrp_display_actual_price_type",
                    "value": "0"
                },
                {
                    "attribute_code": "url_key",
                    "value": "hudson02-CELESTE-29"
                },
                {
                    "attribute_code": "gift_message_available",
                    "value": "0"
                },
                {
                    "attribute_code": "required_options",
                    "value": "0"
                },
                {
                    "attribute_code": "has_options",
                    "value": "0"
                },
                {
                    "attribute_code": "meta_title",
                    "value": "hudson02-CELESTE-29"
                },
                {
                    "attribute_code": "meta_keyword",
                    "value": "hudson02-CELESTE-29"
                },
                {
                    "attribute_code": "meta_description",
                    "value": "hudson02-CELESTE-29"
                },
                {
                    "attribute_code": "tax_class_id",
                    "value": "2"
                },
                {
                    "attribute_code": "category_ids",
                    "value": []
                },
                {
                    "attribute_code": "color",
                    "value": "5444"
                },
                {
                    "attribute_code": "sizee",
                    "value": "5486"
                }
                
            ]
        }
    }
0

Please share your code so we can see how you create the two custom attributes.

are the two attributes different from each other? maybe one is text/select/multiselect etc.

We can't help you without the related code or specific informations.

docs: https://devdocs.magento.com/videos/fundamentals/add-new-product-attribute/

Cheers

1
  • Hey, i updated the question with the codes, have a look. – Rafael Fagundes Aug 4 '20 at 14:47
0

I found the answer, i looked at the admin menu -> stores -> attribute set, and the custom attribute was unsigned. so i passed it to signed.

2
  • Are you able to put more description on what you did to resolve this issue? alternatively, we can also delete this question if you prefer? – Herve Tribouilloy Aug 4 '20 at 19:53
  • Actually i solved this on the attribute set, i was using default attribute set, but the "size" attribute was unsigned, so it wasn't working and isn't calculating the attribute to the product, so i turned the attribute to "Signed" and worked. – Rafael Fagundes Aug 4 '20 at 20:31

Your Answer

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

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