Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the domReady! statement for editing the cart product on the PDP #5

Merged
merged 1 commit into from
Jan 18, 2018
Merged

Add the domReady! statement for editing the cart product on the PDP #5

merged 1 commit into from
Jan 18, 2018

Conversation

arnoudhgz
Copy link

Description

When you are on the cart page and click on the 'edit' link for a product you are being redirected to the PDP and the current amount for that product that is in the cart should be filled in the amount field on the PDP.

In production mode when the settings minify and merge the javascript files in Stores > Configuration > Advanced > Developer are enabled the jquery selector sometimes (depending on the amount of javascript files) returns no values because the DOM is not ready when the script is executed.

By adding the domReady! statement in the require part we are sure that when the jQuery selector is being filled the DOM is ready.

This issue could not be reproduced on a clean magento 2.2 installation, but in a project where significantly more (external) modules (and therefore more javascript files) are included the issue occurred.

Manual testing scenarios

  1. Go to a PDP
  2. Add a product to the cart
  3. Go to the cart page (view and edit cart from the minicart)
  4. Click the edit button for the product in the cart
  5. See that the amount that you have in your cart for the product is being filled in the amount field on the PDP.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

The jquery selector sometimes (depending on the amount of javascript
files) returns no values because the DOM is not ready when the script is
executed.

By adding the domReady! statement in the require part we are sure that
when the jQuery selector is being filled the DOM is ready.
@lenlorijn
Copy link

Do you have a link to a related bug report?

@arnoudhgz
Copy link
Author

arnoudhgz commented Jan 18, 2018

@lenlorijn no there is no bug report, we ran into this problem during working on a project.

@lenlorijn lenlorijn merged commit bb5d086 into mediact:2.2-develop Jan 18, 2018
jasperzeinstra pushed a commit that referenced this pull request Jan 2, 2019
jasperzeinstra pushed a commit that referenced this pull request Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants