-
Notifications
You must be signed in to change notification settings - Fork 9.4k
catalogAddToCart moved to data-mage-init and product_sku option removed #35349
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
catalogAddToCart moved to data-mage-init and product_sku option removed #35349
Conversation
Hi @iNeViX. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review. For more details, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests 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. ✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Functional Tests CE, Functional Tests CE, Integration Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
HI @iNeViX and @nuzil Thanks for your contribution and collaboration. Tried reproducing the issue in Reproducible steps
Also created the file app/code/Solwin/Core/view/frontend/web/js/load-more.js load-more.js file has the code update that is given in the above description only!
Not able to see the button at all in the front end, and just visible as shown in the below screenshot. Can you please help us to know how can we reproduce in 2.4-develop branch first. So that later, we can check the fixes of this PR as well. |
hey @engcom-Alfa! |
@magento run Functional Tests EE, Integration Tests |
@engcom-Lima I record a short video to show the steps of testing: As I see, the general issue is the So, you have 2 ways to fix the issue:
<script type="text/x-magento-init">
{
"*": {
"Solwin_Core/js/load-more": {}
}
}
</script>
app/design/frontend/Solwin/freego/Magento_Catalog/web/js/load-more.js PS: I've updated the PR's description for 2d way. |
@magento run Functional Tests EE, Integration Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento create issue |
@magento give me test instance |
Hi @engcom-Lima. Thank you for your request. I'm working on Magento instance for you. |
Hi @engcom-Lima, here is your Magento Instance: https://9a3057a05725c1eda8741b14ae0731d5.instances.magento-community.engineering |
Hi @Ineix, @nuzil Thanks for detailed reply with recorded video. As per your video, issue is there in the frontend catalog grid view where the add to cart button is disabled once after clicking on I have applied this PR file changes, the unavailability of Can you please retest PR file changes in Magento 2.4-develop version and let us know if issue is still existing. |
@engcom-Lima I've investigated and I don't have this issue. I recorded new video, please follow the link. As I see on your record, you have a lot of non-default modifications which don't exist in the Magento Blank theme. Are you sure that you don't have rewrites of list.phtml files? Or maybe this button is hidden by the non-default styles... Try to:
3. Remove other directories with templates and styles. Other way: bin/magento dev:template-hints:enable && bin/magento cache:clean |
Description (*)
I've implemented products infinite scroll for a project and I got a bug that
catalogAddToCart
widget doesn't work for new loaded items after repeating scripts applying.It happens because I tried to load only items from a grid which exists only in a loop but the script tag that has to call

catalogAddToCart
inserted after the grid:It can be fixed by manual widget calling after parsing html, as:

But before doing that I didn't understand why the option

product_sku
added to the widget when this initialization is outside of loop:I've investigated how it works, and I got that the option doesn't necessary, because the product SKU passed to widget from the form data attribute:

And I've additionally investigated that elements with the selector

.form.map.checkout
don't exist on PLP:So, we can remove it from the template.
And better solution is to move the script initialization to the loop to fix the issue when the product will be loaded after AJAX, all scripts inside the loop can be initialized by triggering the event


contentUpdated
without separated calling ofcatalogAddToCart
widget:Related Pull Requests
When the script have been added:
617d107
When the property
product_sku
was added:3494fbb
Manual testing scenarios (*)

7. AJAX Add to Cart widget has to work for all uploaded items.Contribution checklist (*)
Resolved issues: