Add the photo book editor to WordPress
Enqueue the Studio embed script from your theme, then place the editor container on the page where customers create their book.
The example adds the finished book to the WooCommerce cart through the Store API. After payment, your server confirms the Studio order reference so Studio can print the book.
WordPress example
<?php
// functions.php — enqueue the Studio embed script
function studio_enqueue() {
wp_enqueue_script(
'studio-embed',
'https://studio.prodigi.com/embed.js',
[],
null,
true
);
}
add_action('wp_enqueue_scripts', 'studio_enqueue');
?>
<!-- In your page template or shortcode output: -->
<div id="photobook-designer"></div>
<script>
document.addEventListener('DOMContentLoaded', function() {
PhotobookGenerator.create(
document.getElementById('photobook-designer'),
{
merchantId: 'YOUR_MERCHANT_ID',
onComplete: function(payload) {
// Add payload.lineItem to WooCommerce cart via AJAX. Keep
// payload.order.reference with the order: after payment your
// server confirms it with POST /v1/orders/{reference}/submit.
fetch('/wp-json/wc/store/cart/add-item', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ id: payload.lineItem.sku, quantity: 1 }),
});
},
}
);
});
</script>