Description
Steps to reproduce the issue
- Make sure you have a WP site connected to a valid Mailchimp account and list.
- Log into the Mailchimp account and go to Audience > All contacts > Manage contacts > Groups. Make sure the list you're editing is the list you connected to Jetpack.
- Click Create Groups and create a group for the list that's connected via Jetpack.
- On the connected WP site, add a Mailchimp block to a post or page. In the block's sidebar attributes, expand Mailchimp Groups and select the group you just created (it might take a few seconds to appear). Update.
- View the post/page front-end. Enter a real email address and confirm that the subscribe request works and returns a success message.
- On the Mailchimp side, go to Audience > All contacts and verify that your email address has been subscribed to your list, assigned to the selected group.
- Still in Mailchimp, go back to Manage contacts > Groups and click View Groups. Next to the test group click "Delete" and follow the steps to delete the group.
- In WP, refresh the editor page for the post or page where you added the Mailchimp block. Expand the Mailchimp Groups sidebar panel and observe that the group is no longer shown here (because the list of groups to show as options is fetched directly from Mailchimp, where the group was deleted).
- View the post/page front-end. Enter another real email address, and this time observe that the subscribe request fails with an error message.
- If you inspect the request in Dev Tools > Network, you should see a response something like this:
{
"error": "invalid_resource",
"message": "Mailchimp Error: Invalid interest ID: '<ID of the group you deleted>'."
}
What I expected
If the Mailchimp block's interests
attribute contains an ID that is not contained in the response from Mailchimp to fetch all groups/interests, then that ID should either be shown as deleted in the sidebar and not sent as part of the subscribe request, or purged entirely.
On the front-end, if the response from Mailchimp is an invalid_resource
error, the request should be retried without the group ID returned in the response (or without any groups, if the response doesn't contain an ID) to minimize failure for potential subscribers.
What happened instead
The error happens because the group no longer exists on the Mailchimp side, so its API rejects the request. However, the group ID is still stored in the block's interests
attribute, and will be sent with every signup request. Furthermore, because the list of group options in the editor is fetched from Mailchimp, there's now no indication that a group is selected in the block's attributes, and no way to remove the selected group without destroying the block instance and rebuilding from scratch.
Metadata
Assignees
Labels
Type
Projects
Status
Triaged
Activity