magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

[Confirmed] REST API - Bundle products have empty prices when updating in multiple storeviews

Open NickvdMeij opened this issue 3 years ago • 69 comments

Preconditions and environment

  • Magento version 2.4.3-p1, 2.4.4, 2.4-develop
  • Multistore Setup
  • REST API access

Steps to reproduce

  1. create a bundle product with multiple virtual products in it
  2. update the bundle product options for store 1 using the Rest API (price gets set correctly for store 1)
  3. update the bundle product options for store 2 using the Rest API (price gets set correctly for store 2, but all prices for store 1 get set to 0)

Expected result

Both stores have their prices set correctly

Actual result

Only the last store has their prices set correctly. All other stores have their option prices set to 0

Additional information

No response

Release note

No response

Triage and priority

  • [x] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

Hi @NickvdMeij. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Jun 09 '22 09:06 m2-assistant[bot]

@magento give me 2.4-develop instance

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@magento give me 2.4-develop instance

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

nice....

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

https://github.com/magento give me 2.4-develop instance

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

@magento give me 2.4-develop instance

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@magento give me 2.4.3-p1 instance

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@magento give me 2.4.3-p1 instance

NickvdMeij avatar Jun 09 '22 09:06 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 10 '22 06:06 m2-assistant[bot]

Hi @NickvdMeij ,

Thank you for raising an issue and need your assistance on rest api for optionId. Kindly confirm below rest api what we have tried for updating.

Screenshot 2022-06-20 at 5 35 23 PM

From Frontend options for bundle product:

Screenshot 2022-06-20 at 5 38 56 PM

engcom-Delta avatar Jun 20 '22 12:06 engcom-Delta

@magento give me 2.4.3-p1 instance

NickvdMeij avatar Jul 01 '22 08:07 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

Hi @NickvdMeij ,

Thank you for raising an issue and need your assistance on rest api for optionId. Kindly confirm below rest api what we have tried for updating.

Screenshot 2022-06-20 at 5 35 23 PM

From Frontend options for bundle product:

Screenshot 2022-06-20 at 5 38 56 PM

This is not the bug i was reffering to. The bug happens currently since update 2.4.3-p1 but sadly i cant get a clean magento instance to test it for you guys, or setup a testcase for that matter.

Like in the bug description, if you have multiple stores, it removed all bundle options from the previous siteview if you update them in a different site view using the REST api. So the next sequence happens:

  • create bundle product ** product is now available in all site views
  • update bundle options in site 1 ** product options are now only available in site 1, but site 2 and 3 have their options deleted in the frontend (due to option prices set to 0)
  • update bundle options in site 2 ** product options are now only available in site 2, but site 1 and 3 have their options deleted in the frontend (due to option prices set to 0)
  • update bundle options in site 3 ** product options are now only available in site 3, but site 1 and 2 have their options deleted in the frontend (due to option prices set to 0)

NickvdMeij avatar Jul 01 '22 08:07 NickvdMeij

Hi @NickvdMeij, unfortunately there is no ability to deploy Magento instance at the moment. Please try again later.

@engcom-Delta please fix this. Been trying to get a test instance for a while now and it always seems to be unavailable...

NickvdMeij avatar Jul 01 '22 08:07 NickvdMeij

@magento give me 2.4-develop instance

NickvdMeij avatar Jul 01 '22 08:07 NickvdMeij

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij. Thank you for your request. I'm working on Magento instance for you.

Hi @NickvdMeij, here is your Magento Instance: https://7ff998fa60b9f771262155e3bd82428a.instances.magento-community.engineering Admin access: https://7ff998fa60b9f771262155e3bd82428a.instances.magento-community.engineering/admin_61e1 Login: 041f0574 Password: d6ab2a4e55dd

After finally being able to do some testing on a clean magento image, I sadly did not manage to reproduce it in the 2.4.4-develop branch. However, I did come across another illogical bug surrounding the same workflow.

In the test instance, i created 3 websites+stores+storeviews names store_view_1 to store_view_3. I created 3 virtual products, 1 meant as "main product", which is always required in the configuration of the bundle, and 2 optional virtual products, who are not required in the bundle product.

When doing a POST to https://7ff998fa60b9f771262155e3bd82428a.instances.magento-community.engineering/rest/store_view_1/V1/products (keep in mind the store_view_1 in the url, this is the storeview we want to update), it updates the prices. Below you can find the body:

{
   "product":{
      "sku":1004,
      "name":"Bundle product 1",
      "attribute_set_id":4,
      "price":0,
      "status":1,
      "visibility":4,
      "type_id":"bundle",
      "extension_attributes":{
         "stock_item":{
            "is_in_stock":1,
            "qty":1000000
         },
         "bundle_product_options":[
            {
               "option_id":0,
               "title":"main product",
               "required":1,
               "type":"checkbox",
               "position":0,
               "product_links":[
                  {
                     "id":"2049",
                     "sku":"1001",
                     "option_id":0,
                     "qty":1,
                     "price":700,
                     "price_type":0,
                     "is_default":1,
                     "can_change_quantity":0
                  }
               ]
            },
            {
               "option_id":1,
               "title":"optional product 1",
               "required":0,
               "type":"checkbox",
               "position":1,
               "product_links":[
                  {
                     "id":"2050",
                     "sku":"1002",
                     "option_id":1,
                     "qty":1,
                     "price":150,
                     "price_type":0,
                     "is_default":0,
                     "can_change_quantity":0
                  }
               ]
            },
            {
               "option_id":2,
               "title":"optional product 2",
               "required":0,
               "type":"checkbox",
               "position":2,
               "product_links":[
                  {
                     "id":"2051",
                     "sku":"1003",
                     "option_id":2,
                     "qty":1,
                     "price":150,
                     "price_type":0,
                     "is_default":0,
                     "can_change_quantity":0
                  }
               ]
            }
         ]
      },
      "custom_attributes":[
         {
            "attribute_code":"price_view",
            "value":1
         },
         {
            "attribute_code":"price_type",
            "value":1
         },
      ]
   }
}

It will create the product in the specified storeview. All seems to work perfect.

HOWEVER

when making a POST to https://7ff998fa60b9f771262155e3bd82428a.instances.magento-community.engineering/rest/store_view_2/V1/products (keep in mind the difference in storeview) with the following body:

{
   "product":{
      "sku":1004,
      "name":"Bundle product 1",
      "attribute_set_id":4,
      "price":0,
      "status":1,
      "visibility":4,
      "type_id":"bundle",
      "extension_attributes":{
         "stock_item":{
            "is_in_stock":1,
            "qty":1000000
         },
         "bundle_product_options":[
            {
               "option_id":0,
               "title":"main product",
               "required":1,
               "type":"checkbox",
               "position":0,
               "product_links":[
                  {
                     "id":"2049",
                     "sku":"1001",
                     "option_id":0,
                     "qty":1,
                     "price":999,
                     "price_type":0,
                     "is_default":1,
                     "can_change_quantity":0
                  }
               ]
            },
            {
               "option_id":1,
               "title":"optional product 1",
               "required":0,
               "type":"checkbox",
               "position":1,
               "product_links":[
                  {
                     "id":"2050",
                     "sku":"1002",
                     "option_id":1,
                     "qty":1,
                     "price":999,
                     "price_type":0,
                     "is_default":0,
                     "can_change_quantity":0
                  }
               ]
            },
            {
               "option_id":2,
               "title":"optional product 2",
               "required":0,
               "type":"checkbox",
               "position":2,
               "product_links":[
                  {
                     "id":"2051",
                     "sku":"1003",
                     "option_id":2,
                     "qty":1,
                     "price":999,
                     "price_type":0,
                     "is_default":0,
                     "can_change_quantity":0
                  }
               ]
            }
         ]
      },
      "custom_attributes":[
         {
            "attribute_code":"price_view",
            "value":1
         },
         {
            "attribute_code":"price_type",
            "value":1
         },
      ]
   }
}

It updates the prices IN ALL STOREVIEWS. Is this normal? Because from what i can read in the documentation it should only update the prices for the specified storeview (in this case store_view_2) and not in store_view_1 or store_view_3.

In our own 2.4.3-p1 instance of magento, doing the same flow results in store_view_1 with all its virtual products with a price of 0, and only have the store_view_2 with all virtual products on 999 as specified in the request above. So something definately changed between these 3 versions (prior to 2.4.3-p1, in 2.4.3-p1 and in 2.4.4-develop)

NickvdMeij avatar Jul 01 '22 11:07 NickvdMeij