Star Map Builder for WooCommerce
WordPress plugin for Star Map configurator with WooCommerce integration
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/fnpsk/starmap-builder/archive/refs/heads/main.zipPlugin WordPress pour intégrer un configurateur de carte du ciel avec WooCommerce.
Installation
- Télécharger le plugin (ZIP ou clone)
- Uploader dans
wp-content/plugins/starmap-builder/ - Activer dans WordPress Admin > Extensions
- Configurer dans WooCommerce > Star Map Builder
Configuration
1. Mapping des produits
Dans WooCommerce > Star Map Builder, associez vos produits WooCommerce aux types de produits Star Map :
- Poster : Produit variable avec variations taille/papier/cadre
- Digital : Produit simple pour le fichier numérique
2. Attributs WooCommerce requis
Le produit variable doit avoir ces attributs (noms personnalisés, pas taxonomies) :
| Attribut | Valeurs |
|---|---|
size |
small, mmedium, Large |
paper |
standard, premium |
frame |
none, bois, alu |
3. Variations
Créez les variations correspondantes. Note : Les prix peuvent être à 0 - le plugin applique un tarif dynamique.
Utilisation
Shortcode
[starmap_builder]
[starmap_builder height="800px"]
Mode Embedded vs Iframe
- Embedded (défaut) : L'app React est chargée depuis
assets/dist/ - Iframe : Définir une URL externe dans les paramètres
API REST
Endpoints
| Méthode | Endpoint | Description |
|---|---|---|
| POST | /wp-json/starmap/v1/cart/add |
Ajouter au panier |
| GET | /wp-json/starmap/v1/nonce |
Obtenir un nonce |
| GET | /wp-json/starmap/v1/products |
Liste des produits |
| GET | /wp-json/starmap/v1/debug |
Debug (admin) |
Exemple d'ajout au panier
const response = await fetch('/wp-json/starmap/v1/cart/add', {
method: 'POST',
credentials: 'include',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
product_slug: 'poster',
size: 'M',
design_type: 'classic',
design_data: {
date: '2024-12-25T22:00:00',
latitude: 48.8566,
longitude: 2.3522,
location_name: 'Paris, France',
title: 'Notre première nuit',
shape: 'circle',
background_color: '#0a0a0a'
},
print_file: 'data:image/svg+xml;base64,...',
_wpnonce: 'xxx'
})
});
Tarification dynamique
Si les variations ont un prix à 0, le plugin applique ces tarifs par défaut :
| Taille | Standard | Premium |
|---|---|---|
| S (30x40) | 29.90€ | 39.90€ |
| M (50x70) | 49.90€ | 59.90€ |
| L (70x100) | 69.90€ | 79.90€ |
Supplément cadre : +20€ (bois), +30€ (alu)
Personnalisable via l'option starmap_pricing_table.
Debug
- Activer WP_DEBUG dans wp-config.php
- Consulter
/wp-json/starmap/v1/debug(connecté en admin) - Vérifier les logs dans
wp-content/debug.log
Structure
starmap-builder/
├── starmap-builder.php # Bootstrap
├── includes/
│ ├── class-starmap-rest-api.php # Endpoints REST
│ ├── class-starmap-variation-resolver.php # Résolution variations
│ ├── class-starmap-cart.php # Intégration panier
│ ├── class-starmap-shortcode.php # Shortcode
│ └── class-starmap-admin.php # Page settings
├── assets/
│ ├── dist/ # App React buildée
│ ├── css/
│ └── js/
└── setup-test.php # Script de test (WP-CLI)
Licence
Propriétaire - Science Labs