Have you ever tried to setup your google calendar to sync with a WordPress plugin? Or for that matter any third party plugin/app?
We made the Booking & Appointment Plugin for WooCommerce compatible with Google Calendar more than a year ago. After which, we’ve had a few support requests from customers mentioning an issue where they are unable to setup their google calendars to allow creating/editing of events by third party plugins.
This is especially needed when we want a third party plugin (like the Booking plugin) to automatically add/edit/delete events in our calendars and make sure the calendars are in sync with the website data.
The below post uses the Booking & Appointment plugin as an example for a third party plugin. However, the instructions can be followed for any third party plugin which is trying to sync their data with google calendar.
In the case of the Booking plugin, after following all the steps mentioned in Booking->Settings->Google Calendar Sync->Admin Calendar Sync Settings->Sync Automatically->Show me how, the user still receives a Test Connection failed message.
When trying to setup automated export to google calendar from the Booking plugin, the Service Account Email Address needs the permission to be able to ‘Manage all changes to events’ instead of simply allowing it to the able to ‘See all event details’.
Sometimes this permission defaults to ‘See all event details’ instead of ‘Make Changes to events’ in the Google Calendar->Calendar Settings->Share this Calendar tab.
As a result, the plugin/app is unable to create events in your google calendar even though all the details entered are correct.
This can happen when your Gmail account does not have the permission to setup other users to allow edit access to the calendars.
This can happen for any plugin or app that is trying to sync the events with your google calendar. Hence, the first action that needs to be taken is to make sure our users have all the permissions and the setup is correct. This is seen mostly in accounts created for domains. For e.g. my email account pinal at tychesoftwares dot com does not have this permission.
So even though I follow all the steps in the Booking plugin listed in Booking->Settings->Google Sync Settings->Sync Automatically->Show me how, I’m unable to successfully setup a connection from the site to the calendar created in my account pinal at tychesoftwares dot com.
This can be fixed by the admin user (in this case vishal at tychesoftwares dot com). The admin has the ability to change the settings. All the below mentioned steps need to be performed by the admin user.
Step 1: Access your user account.
1. Go to admin console of your Google business email account
2. Click on Users
3. Click on the user whose account you want to create the Calendar settings for. In this case it will be Pinal Shah
Step 2: Access the Calendar app
1. Click on the link View active Google apps and services
2. It will display the apps which are enabled for that user. Please click on Calendar app. If you don’t see the Calendar app here, then you will need to turn it on or enable it.
Increase WooCommerce Store Sales
"Customer service is great, they go above and beyond to assist and corrected any issues I had with setting everything up in a timely manner. I use the abandoned cart plugin and am very satisfied with the results and carts recovered." - Bran Weintraub
Step 3: Access and modify the Sharing settings.
1. Click on the Sharing Settings link.
2. On that page, in the External sharing options for primary calendars field, please select: Share all information, and outsiders can change calendars.
Once the changes were made, I was able to setup the Service Account Email Address with the permission ‘Make changes to events’ and run the test connection successfully on pinal at tychesoftwares dot com.
Most of the times, these changes are enough to get the Calendar API working. However if it still doesn’t work, you can try one of the below two options or both as needed to help fix the issue.
Even after modifying the Sharing settings, if you still face an issue where the Test connection fails and results in a 403 error, you might have to disable the Resource Booking Permissions in Google admin->Apps->G Suite->Calendar->General Settings->Resources.
- Modify the Resource booking permissions setting and set it to disabled.
- Set the Secondary Calendar Sharing Options in General Settings to ‘Share all information, and allow managing of calendars’
The above changes will help setup the connections as needed. This can be confirmed by running a Test Connection and ensuring the results were successful.
So, if you face an issue where the permissions for Service Account Email Address keep defaulting, it becomes necessary to check the setup of the permissions.
This is applicable for any plugin/app that might be trying to sync data with your google calendar.
The above steps will help ensure that our user account has all the permissions setup correctly thereby allowing us to grant other users permissions.
In case if you have faced similar issues and know of ways to fix it apart from the ones mentioned above, do let me know in the comments below!