magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Multiple hyphens in sku when adding to cart

Open RetroProgrammist opened this issue 1 year ago • 11 comments

Preconditions and environment

  • 2.4.6-2.4.7

Steps to reproduce

  1. Create a simple product
  2. add custom options either multiselect or checkbox with multiple values (3+)
  3. Go to the product page and add to cart by selecting 3 or more option values of multiselect / checkbox type.
  4. Check quote_item table sku column

Expected result

Product sku only

Actual result

Product sku with hyphens on end

Additional information

The problem can be solved by adding a check for null or empty value in the \Magento\Catalog\Model\Product\Option\Type\Select::getOptionSku method. line 302 eg. instead of it $skus[] = $optionSku->getSku(); use

      if(!empty($optionSku->getSku())) {
          $skus[] = $optionSku->getSku();
      }

Release note

No response

Triage and priority

  • [ ] 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.
  • [X] 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”.

RetroProgrammist avatar Mar 13 '24 15:03 RetroProgrammist

Hi @RetroProgrammist. Thank you for your report. To speed up processing of this issue, 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:


Join Magento Community Engineering Slack and ask your questions in #github channel. :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.

m2-assistant[bot] avatar Mar 13 '24 15:03 m2-assistant[bot]

Hi @engcom-Bravo. 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).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas 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 Mar 13 '24 15:03 m2-assistant[bot]

@magento give me 2.4-develop instance

engcom-Bravo avatar Mar 14 '24 05:03 engcom-Bravo

Hi @engcom-Bravo. Thank you for your request. I'm working on Magento instance for you.

Hi @engcom-Bravo, here is your Magento Instance: https://3594027baadf33d34996d5dc446e7612.instances-prod.magento-community.engineering Admin access: https://3594027baadf33d34996d5dc446e7612.instances-prod.magento-community.engineering/admin_f6a8 Login: 043a586a Password: b510db3a2a6a

Hi @RetroProgrammist,

Thank you for reporting and collaboration.

Verified the issue on Magento 2.4-develop instance and the issue is reproducible.Kindly refer the screenshots.

Steps to reproduce

  • Create a simple product
  • add custom options either multiselect or checkbox with multiple values (3+)
  • Go to the product page and add to cart by selecting 3 or more option values of multiselect / checkbox type.
  • Check quote_item table sku column

Screenshot from 2024-03-14 11-50-55

Product sku with hyphens on end

Hence Confirming the issue.

Thanks.

engcom-Bravo avatar Mar 14 '24 06:03 engcom-Bravo

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-11598 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Mar 14 '24 06:03 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Bravo. Thank you for verifying the issue.
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Mar 14 '24 06:03 m2-assistant[bot]

I have been chasing this same problem for months as we thought it was caused by a 3rd party module. Only recently have we tied it down to that Select.php file. We are yet to fix this.

From experience, I would argue that the Triage and priority should be S1.

Reason being, when a customer checks out, that SKU is transferred into the sales_order_item table with the extraneous hyphens. Our mailer puts the ordered product details into the email, but as the SKUs have extra hyphens, it cannot find any matching info in the catalog, causing the mailer to balk and the checkout process to stop. Customers do not know the order has been logged and monies taken, so either try again creating duplicate orders, or leave the site annoyed. Either way, it is a poor customer experience. We have had to refund orders after customers have gone elsewhere, and our customer service department got regular hell over the phone until we discovered the workaround.

The workaround we have been using is direct in the DB:

SELECT * from quote_item WHERE sku LIKE '%--';

And remove the extra hyphens.

If the order has already completed, we use:

SELECT * from sales_order_item WHERE sku like '%--';

Remove the extra hyphens and manually send the email using the "Send Email" button in admin > orders

xamax-dev avatar Mar 15 '24 16:03 xamax-dev

@magento I am working on this

dekiakbar avatar Jun 01 '24 08:06 dekiakbar

Hi @RetroProgrammist ,

Thank you for reporting and collaboration. Reverified the issue on Magento 2.4-develop instance and the issue is reproducible. Kindly refer the screenshots.

Steps to reproduce :

  1. Create a simple product
  2. add custom options either multiselect or checkbox with multiple values (3+)
  3. Go to the product page and add to cart by selecting 3 or more option values of multiselect / checkbox type.
  4. Check quote_item table sku column Observe sku value is displaying as expected along with custom options
Image

Can you please reverify in latest 2.4-develop instance and confirm. Thanks.

engcom-Delta avatar Dec 08 '25 13:12 engcom-Delta