Unable to edit the membership end date for members that have a recurring payment
I am working on a website that has the option for members to pay for membership by direct debit (via GoCardless). This is working fine but occasionally we have an issue where a member pays by direct debit and also by card (via SagePay). We refund the card payment to the member and update the related contribution in CiviCRM. This part is fine but the membership end date is incorrect and we are unable to edit it.
The membership is annual so if a member signs up by both direct debit and card the two payments will add two years to the end date (e.g. it will end in 2021 rather than 2020). So, after we refund the card payment we want to also edit the end date to change it to 2020. Unfortunately, we are unable to do this.
Normally, you can edit the end date, as shown below:
It appears that if the membership is set as auto-renew and linked to a recurring payment then CiviCRM doesn't allow users to edit the end date. I presume this is a deliberate 'feature' but in our case it is preventing us from correcting the end date.
The site is running CiviCRM 5.7.6 on WordPress.
I have posted a question on StackExchange about this issue to see if there was a workaround but I think it is a bug.