Skip to main content

WooCommerce Integration

This guide walks you through adding a pattern configurator to WooCommerce product pages using the PixCraft API.

Overview

  1. Create a simple WordPress plugin
  2. Add a “Configure Pattern” button to product pages
  3. When clicked, show a modal where customers upload an image
  4. Call the PixCraft API from your server to generate the pattern
  5. Display the result and optionally generate a PDF

Step 1: Create the plugin

Create a file at wp-content/plugins/pixcraft-configurator/pixcraft-configurator.php:

Step 2: Add the AJAX endpoint

Add to the same plugin file:

Step 3: Add the frontend button

Step 4: JavaScript configurator

Create configurator.js:

Next steps

  • Add CSS styling to match your theme
  • Implement image upload to WordPress media library
  • Add PDF download button using the /generate/pdf endpoint
  • Store generated patterns as order metadata