Skip to content

Disable add to cart button when redirect to cart enabled #14060

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

Conversation

ihor-sviziev
Copy link
Contributor

Description

Disable add to cart button when redirect to cart enabled, it includes product validation.

Fixed Issues (if relevant)

N/A

Pre-requisites

  1. Install Magento 2.2.3
  2. Go to Admin >> Stores >> Configuration >> Sales >> Checkout
  3. In "Shopping Cart" section change "After Adding a Product Redirect to Shopping Cart" to "Yes"

Manual testing scenarios

  1. Go to product page on frontend with very slow internet connection (could be emulated in chrome)
  2. Click "Add to Cart" button

Expected result

  1. After clicking "Add to cart" button should became to disabled
  2. Button color should be changed to "disabled" (grey)
  3. Text on "add to cart" is changed to "Adding...", then to "Added"

Actual result

  1. After clicking "Add to cart" button is not became to disabled
  2. Button color is not changed to "disabled" (grey)
  3. Text on "add to cart" is not changed to "Adding...", then to "Added"

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)

@rogyar
Copy link
Contributor

rogyar commented Mar 15, 2018

Hi @ihor-sviziev. The solution works in general but does not work in some particular cases. For example, if we have a simple product with the custom date option (required). Maybe there are some other cases as well.

@ihor-sviziev
Copy link
Contributor Author

ihor-sviziev commented Mar 17, 2018

Hi @rogyar,
It looks as separate issue. Date custom option adds new validation (looks like overrides) to the same form. Probably when redirect to shopping cart is disabled - we will have this issue too.

<script type="text/x-magento-init">
{
"#product_addtocart_form": {
"validation": {
"ignore": ":hidden:not(input[name^='validate_datetime_'])"
}
}
}
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants