GooglePay and ApplePay buttons disappear from the minicart when adding a product to the cart on the shop page (PCP-2472) #1915
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Description
This PR handles rerendering of
ApplePay
andGooglePay
buttons onwc_fragments_loaded wc_fragments_refreshed
event.Issue Description
When adding a product to the Minicart on the shop page the GooglePay and ApplePay buttons disappear.
Before adding to cart:
![image](https://private-user-images.githubusercontent.com/45217709/291367170-c85aa897-e0ce-400b-bdb5-085283912b05.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTA2ODgsIm5iZiI6MTczOTYxMDM4OCwicGF0aCI6Ii80NTIxNzcwOS8yOTEzNjcxNzAtYzg1YWE4OTctZTBjZS00MDBiLWJkYjUtMDg1MjgzOTEyYjA1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA5MDYyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5NDMyZjMxNzhmNzI3NDMxYTBjMTk5ZDdlNzY4MTEzM2VhNWU1YmYxZDQ2NDcyMjdjZjgwNTUxN2QyZThiNGYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.5mgMo3Ktgn8iXMV_3d0Jx8KwYfdT_PN9RUfQxDNurko)
After adding to cart:
![image](https://private-user-images.githubusercontent.com/45217709/291367198-8a654d2b-ce8c-4464-8ffe-6edf8f04d6ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MTA2ODgsIm5iZiI6MTczOTYxMDM4OCwicGF0aCI6Ii80NTIxNzcwOS8yOTEzNjcxOTgtOGE2NTRkMmItY2U4Yy00NDY0LThmZmUtNmVkZjhmMDRkNmFlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA5MDYyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWE4MWU3MGI5NTIxNmY2NWRhNmE4OTRlMWY5NTM2YzEwZTg1NDYwNmQ0M2Q1OGQ3YzYzZmNmYjg3NTdmYjY3MzQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.qPED2026qUMTfRoyd9Zi4z54nrVxRTd7kRfGrqzVpaQ)
Steps To Reproduce
Expected behaviour
After adding a product to cart on the shop page the minicart still has the GooglePay and ApplePay buttons visible.
Possible cause
This is probably due to the minicart dom element being rerendered and but the GooglePay and ApplePay buttons not handling this event.
Suggested solution
GooglePay and ApplePay buttons should handle the Minicart rerendering event.