19. WooCommerce Integration.

WooCommerce is the most popular WordPress e-commerce plugin. If the subscription has a WordPress integration enabled and the e-commerce add-on is active, it’s possible to use the integration with WooCommerce to monetize the Open edX courses. WooCommerce is flexible, versatile, and free; this plugin can provide a great solution for LMS sites integrated with WordPress that need to sell products such as Open edX courses.

In the following instructions, you will find all the relevant information to configure the WooCommerce plugin integrated with your LMS site.

19.1. Integration requisites.

  • It is required to have your LMS site in a domain of your own.

  • Active WordPress + LMS integration.

  • EOX APIs add-on enabled.

19.2. Configuration steps.

19.2.1. Install WC custom thank you plugin.

Go to Plugins and install the WC custom thank you page. This plugin will allow customizing the page where a thanks message is shown after users make a payment.

../../_images/woocommerce-customthankyou.gif

19.2.2. Client ID and client secret.

Go to Open edX WP-integrator- General settings, and add the client ID and client secret.

../../_images/woocommerce-clientid-secret.gif

See also

To enable and configure the EOX APIs, you can visit the following Page.

19.2.3. WooCommerce settings in the Open edX LMS and WordPress integrator Plugin.

Go to Open edX WP-integrator- WooCommerce Integration, and enable the following options.

  • Enable the Woocommerce integration

  • Woocommerce trigger action: WooCommerce payment complete.

  • Default enrollment fulfillment action: Process request (recommended).

  • User Profile fields mapping: This is an advanced feature only supported for eduNEXT customers. Mapping of user fields for pre-filling, from Open-edX (extended_profile) to Woocommerce (checkout)

{"billing_email": "email" , "billing_first_name": "name"}
  • Assert users are logged in to see the cart: If you want to force users to log in before seeing the cart page.

  • Lms redirect path for the cart: Path that passed into the lms ?next= parameter takes the user back to the Woocommerce cart.

  • Get username information from Open edX into the checkout page: The email address will be automatically populated in the checkout form as long as the user is logged in.

  • Lms redirect path for the checkout form: Path that passed into the lms ?next= parameter takes the user back to the Woocommerce checkout form.

  • User Profile fields mapping for client-side pre-filling: Mapping of user fields for pre-filling, from the accounts API in Open edX to the to Woocommerce checkout form fields.

{"billing_email": "email" , "billing_first_name": "name"}
../../_images/woocommerce-settings-plugin.gif

19.2.4. Settings in the WooCommerce plugin.

Go to WooCommerce-Settings on the left panel, and adjust the following options:

  • Accounts and privacy

Guess checkout: Allow customers to place orders without an account

  • Account creation

All these options must be disabled since we would be using the Open edX session and not the WordPress one.

  • Account erasure requests

Check the options:

  • Remove personal data from orders on request

  • Remove access to downloads on request

Personal data removal - Allow personal data to be removed in bulk from orders

../../_images/woocommerce-settings-plugin-WP.gif

19.2.5. Establish the Thank you page.

  1. Create the page where the thanks for your purchase message will be placed.

  2. Go to WooCommerce-Settings on the left panel, and adjust the following option:

Advanced

Select the thank you page you just created.

../../_images/woocommerce-customthankyou-selection.gif

19.2.6. Creation of products integrated with the Open edX LMS site.

Once the previous steps are complete, it’s time to start creating products in WooCommerce to sell the Open edX courses.

Note

The purchase of the course usually implies that users will get certificates. Therefore, it’s necessary to have this option configured for the Open edX course.Find more information about setting the certificates in the following Article. This step is crucial to configure the product so that the enrollment will be automatically made after the payment..

Go to Products- Add new, and configure the following options

  • Product name: How your product will appear on the page. This will create an endpoint with /product_name where users will find it.

  • Product main description: You will find an editor where you can create the description for your product

  • Product data: Select simple product- Virtual

  • General: Establish the price and taxes.

  • Inventory: Define:

  • The SKU

  • Stock status

  • Check sold individually

Note

These are the minimum configurations. You can create the product according to your needs.

../../_images/woocommerce-product-new.gif

Attributes:

Add two attributes

Attribute 1.

  • Name: course_id

  • Value (s): Enter the course ID of the course you want to sell. E.g. course-v1:demo-site+certs+en

Attribute 2.

  • Name: course_mode

  • Value (s): Enter honor

../../_images/woocommerce-product-attribute.gif

Note

Don’t check the option Visible on the product page so that this information will not be visible for users.