Demo your Woo extension with WordPress Playground

Are you a Woo extension developer who wants to share a demo of your work with a single click? WordPress Playground is here for you. 

WordPress Playground is a platform that lets you run WordPress instantly on any device without a host. It’s your place to build, experiment, test, and grow.

Out-of-the-box, you’ll get a clean WordPress installation. But with a bit of work and Blueprints, you can spin up a custom WordPress installation, including installing plugins and running custom code. 

You can explore the WordPress Blueprints Gallery, test your Blueprints, or build them from scratch in the WordPress Playground Step Library (built by the Playground engineer Alex Kirk). 

Install WooCommerce

WooCommerce is compatible with WordPress Playground and is a great way to test your extension or share a demo. The first step for installation is easy, just head to Playground Builder and make sure the following code is populated in the virtual IDE:

{
  "landingPage": "/wp-admin/",
  "login": true,
  "plugins": [
    "woocommerce"
  ]
}

However, you’ll notice that you end up in the WooCommerce onboarding flow, which can use up extra time that you’d like to focus on your extension demo.

Here is a quick workaround to skip the WooCommerce onboarding setup wizard (Playground Builder). Kudos to Mujeebu Rahman for sharing this on WordPress Slack:

{
  "landingPage": "/wp-admin/",
  "login": true,
  "plugins": [
    "woocommerce"
  ],
  "steps": [
    {
      "step": "runPHP",
      "code": "<?php include 'wordpress/wp-load.php'; delete_transient( '_wc_activation_redirect' );"
    }
  ]
}

Now you can use the landingPage property to redirect to your extension without WooCommerce overriding it.

Install your extension

Installing extensions from WordPress.org is super simple – you can just include the plugin slug in the plugins property. 

{
  "landingPage": "/wp-admin/",
  "login": true,
  "plugins": [
    "woocommerce",
    "mailpoet"
  ]
}

But installing a ZIP file directly from GitHub is also super easy. 

For example, to install a specific version of MailPoet from GitHub (Playground Builder):

{
  "step": "installPlugin",
  "pluginData": {
    "resource": "url",
    "url": "https://github.com/mailpoet/mailpoet/releases/download/5.6.2/mailpoet.zip"
  }
}

And if you want to get more adventurous, head to https://github-proxy.com/, which makes it easy to use specific tags, releases, PRs, commits…and more!


Don’t have an extension yet? Learn how to build your first extension and then come back to test it in Playground!


Leave a Reply

Your email address will not be published. Required fields are marked *