Print.com Print on Demand - WordPress Plugin
A WordPress plugin that integrates with the Print.com API to enable custom print-on-demand products in WooCommerce stores. Configure, edit, and sell custom printed products seamlessly through your WordPress/WooCommerce site.
✨ Features
- 🖨️ Print.com API Integration - Direct connection to Print.com's print-on-demand services
- 🎨 Product Configuration - Connect your product to a Print.com and we will take care of the fulfilment
- 🎨 Order Synchronization - Automatically receive track-and-trace data from Print.com
🚀 Quick Start
Prerequisites
Installation
-
Clone the repository:
git clone https://github.com/printdotcom/pdc-pod.git cd pdc-pod -
Run composer
-
Start the development environment:
# Start WordPress with PHP 8.2 and WordPress 6.8 bin/run-wordpress 68 82 -
Optionally Seed WooCommerce with sample data:
# Configure WooCommerce and create sample products bin/seed-woocommerce 68 82 -
Optionally use the mock api:
# Configure WooCommerce and create sample products
bin/run-mock-api start- Access your site:
- Frontend: http://localhost:8068
- Admin: http://localhost:8068/wp-admin (admin/password)
🐳 Local Environment
Available Commands
| Command | Description | Example |
|---|---|---|
bin/run-wordpress [WP_VER] [PHP_VER] |
Start WordPress environment | bin/run-wordpress 68 82 |
bin/stop-wordpress [WP_VER] [PHP_VER] |
Stop WordPress environment | bin/stop-wordpress 68 82 |
bin/seed-woocommerce [WP_VER] [PHP_VER] |
Seed WooCommerce with sample data | bin/seed-woocommerce 68 82 |
bin/run-mock-api {start|stop|status} |
Manage Print.com Mock API | bin/run-mock-api start |
Supported Versions
Check config/wp-version.conf for available WordPress/PHP combinations:
# WordPress 6.7 with PHP 7.0 bin/run-wordpress 67 70 # WordPress 6.8 with PHP 8.2 (if available) bin/run-wordpress 68 82
Port Mapping
The port format is 80[WORDPRESS_VERSION]:
- WordPress 6.7:
http://localhost:8067 - WordPress 6.8:
http://localhost:8068
🔧 Configuration
Print.com API Credentials
- Navigate to WordPress Admin → Print.com → Settings
- Enter your Print.com API credentials:
- API Key
- API Secret
- Environment (Sandbox/Production)
🛠️ Development
Code Standards
This project follows:
- WordPress Coding Standards
- WordPress Documentation Standards
- Conventional Commits for commit messages
Translations
When a new translation is added
When you add new strings that need translation in your PHP code:
-
Regenerate the POT template file:
wp i18n make-pot . languages/pdc-pod.pot -
Update existing PO files with new strings:
wp i18n update-po languages/pdc-pod.pot
-
Translate the new strings in each
.pofile using Poedit or a text editor -
Compile translations to MO files:
wp i18n make-mo languages
Adding a New Language
When you want to add a new language:
-
Create a new PO file from the template:
cd languages cp pdc-pod.pot pdc-pod-[LOCALE].poReplace
[LOCALE]with the WordPress locale code (e.g.,es_ESfor Spanish,it_ITfor Italian) -
Update the PO file header with language information:
- Set
Language-TeamandLanguagefields - Add appropriate plural forms for the language
- Set
-
Translate all strings using Poedit or manually edit the
msgstrvalues -
Compile to MO file:
wp i18n make-mo languages
🏗️ Project Structure
pdc-pod/
├── admin/ # Admin-specific functionality
│ ├── AdminCore.php # Main admin class
│ ├── PrintDotCom/ # Print.com API integration
│ │ ├── APIClient.php # API client
│ │ ├── Product.php # Product model
│ │ └── Preset.php # Preset model
│ ├── css/ # Admin stylesheets
│ ├── js/ # Admin JavaScript
│ └── partials/ # Admin template partials
├── bin/ # Development scripts
│ ├── run-wordpress # Start WordPress environment
│ ├── stop-wordpress # Stop WordPress environment
│ └── seed-woocommerce # Seed WooCommerce data
├── config/ # Configuration files
│ ├── docker-compose.yml # Docker Compose configuration
│ └── wp-version.conf # WordPress/PHP version mapping
├── includes/ # Core plugin files
│ ├── Core.php # Main plugin class
│ ├── Activator.php # Plugin activation
│ ├── Deactivator.php # Plugin deactivation
│ └── Loader.php # Hook loader
├── front/ # Public-facing functionality
│ └── FrontCore.php # Main public class
└── vendor/ # Composer dependencies
Autoloading
The project uses PSR-4 autoloading via Composer:
{
"autoload": {
"psr-4": {
"PdcPod\\Admin\\": "admin/",
"PdcPod\\Front\\": "front/",
"PdcPod\\Includes\\": "includes/"
}
}
}Unit tests
Running automated unit tests via phpunit is possible through:
Mock API
When working locally or running end-2-end tests, the mock-api via wiremock will mock the Print.com API.
# Start the mock API
bin/run-mock-api startSee test/wiremock/README.md for detailed documentation.
Releasing
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feat/amazing-feature) - Open a Pull Request
📞 Support
- Documentation: Print.com Developer Docs
- Issues: GitHub Issues
- Email: devops@print.com
📊 Changelog
See CHANGELOG.md for a detailed history of changes.
Made with ❤️ by the Print.com team