Skip to main content

Set up sync

The plugin supports two ways of updating the data in WordPress. The first is a manual sync, and the other an automatic sync based on webhooks.

Manual sync

Before you can show anything on your website, the plugin needs to fetch the data from Eduframe first. In your WordPress admin, the top bar shows a menu called Eduframe. Hover over it and it will show a Sync button. Click this button to tell WordPress to fetch all the data from Eduframe.

note

The manual sync should only be used at the start, just after installing the plugin, or when the data no longer matches Eduframe.

New post types

Now that everything is imported, the sidebar on the left shows a new item called 'Products'. When you open it, it shows a list of all products that are available. The sidebar holds more of these post types, for example Variants, Teachers, and Meetings. Each page shows the data imported from Eduframe that you will be able to show on your website.

For the full list of post types and taxonomies the plugin adds, see Terminology.

Automatic sync

The plugin supports a way to automatically update courses when changes are made in Eduframe. We do this using webhooks. We highly recommend setting this up right after the installation.

To do this, go to Eduframe. Under Settings, you will find a tab called 'Webhooks'. Here you have to add a new webhook with the following URL: 'YOUR_WEBSITE_DOMAIN/wp-content/plugins/eduframe/api/sync.php', where you replace YOUR_WEBSITE_DOMAIN with the domain of your website.

For the webhook to work, you also need to select a couple of events.

Events

  • catalog_variant.created, updated, and deleted
  • product.created, updated, and deleted
  • program.created, updated, and deleted
  • course.created, updated, and deleted
  • teacher_role.created, updated, and deleted
  • user.created, updated, and deleted
  • meeting.created, updated, and deleted
  • label.created, updated, and deleted
  • course_location.created, updated, and deleted
  • course_variant.created, updated, and deleted
  • category.created, updated, and deleted

Manual sync performance

When many products and variants are present, the plugin might have trouble syncing these because you can run into rate limiting problems. When this happens, you can execute the manual sync in steps.

You can apply paging and filters to the sync to limit the number of records for each manual sync. You can do this for the types Catalog::Product and Catalog::Variant. Add the parameters &batch_size=100&batch_offset=100 and increase the batch_offset by 100 until you have covered all of them. The response will show the number of models synchronized.

Example: /wp-content/plugins/eduframe/api/sync.php?model_type=Catalog::Product&batch_size=100&batch_offset=0

For the other types, limiting the batch size is not possible. You can, however, individually sync the following models: Location, CourseVariant, Label, Category, Teacher, and Meeting.

Example: /wp-content/plugins/eduframe/api/sync.php?model_type=Location

note

The automatic sync does not run into rate limiting or timeout issues.