Pièces d'origine d'Allemagne
Qualité Premium pour BMW, Mercedes & VW. Livraison partout au Maroc.
KIT D'IMPLÉMENTATION
Copiez ces codes dans votre thème WordPress (functions.php & style.css)
functions.php
/* ==========================================
GERMAN AUTO PARTS DXN-EU - CUSTOM FUNCTIONS
========================================== */
// 1. STRIP CHECKOUT FIELDS (Keep only Name, Phone, City, Address)
add_filter( 'woocommerce_checkout_fields' , 'dxn_custom_checkout_fields' );
function dxn_custom_checkout_fields( $fields ) {
// Remove Billing Details
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_email']); // Optional: Keep if needed for receipts
// Make City and Phone Full Width
$fields['billing']['billing_city']['class'] = array('form-row-wide');
$fields['billing']['billing_phone']['class'] = array('form-row-wide');
return $fields;
}
// 2. REPLACE ADD TO CART WITH WHATSAPP BUTTON
// Remove standard button
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
// Add Custom WhatsApp Button
add_action( 'woocommerce_single_product_summary', 'dxn_whatsapp_order_button', 30 );
function dxn_whatsapp_order_button() {
global $product;
$phone = '212719301407';
$product_name = $product->get_name();
$sku = $product->get_sku();
$price = $product->get_price();
$url = get_permalink();
// Message in French & Arabic
$message = "Salam, je veux commander cette pièce : \n";
$message .= "🚗 Produit: " . $product_name . "\n";
$message .= "🔢 SKU: " . $sku . "\n";
$message .= "💰 Prix: " . $price . " MAD\n";
$message .= "🔗 Lien: " . $url;
$whatsapp_url = "https://wa.me/" . $phone . "?text=" . urlencode($message);
echo '';
echo ' Commander via WhatsApp';
echo '';
}
// 3. BILINGUAL SUPPORT (Simple Frontend Text Switcher Logic)
// Note: For full translation, use WPML or Polylang plugin.
// This is a helper to display Arabic direction if needed.
add_filter( 'body_class', 'dxn_add_body_classes' );
function dxn_add_body_classes( $classes ) {
if ( is_rtl() ) {
$classes[] = 'rtl';
}
return $classes;
}
style.css
/* ==========================================
GERMAN AUTO PARTS DXN-EU - DARK THEME CSS
========================================== */
:root {
--dxn-black: #111111;
--dxn-dark: #1a1a1a;
--dxn-silver: #E0E0E0;
--dxn-red: #DD0000;
--dxn-yellow: #FFCC00;
}
body {
background-color: var(--dxn-black);
color: var(--dxn-silver);
font-family: 'Roboto', sans-serif;
}
h1, h2, h3, h4, h5, h6 {
font-family: 'Rajdhani', sans-serif;
color: #ffffff;
text-transform: uppercase;
}
/* Buttons */
.woocommerce button.button,
.woocommerce a.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce #content input.button,
.woocommerce-page #respond input#submit,
.woocommerce-page #content input.button {
background-color: var(--dxn-red) !important;
color: #ffffff !important;
border-radius: 4px;
text-transform: uppercase;
font-weight: 700;
border: none;
transition: all 0.3s ease;
}
.woocommerce button.button:hover,
.woocommerce a.button:hover {
background-color: #ff1a1a !important;
transform: translateY(-2px);
box-shadow: 0 4px 15px rgba(221, 0, 0, 0.4);
}
/* Prices */
.woocommerce .price,
.woocommerce-Price-amount {
color: var(--dxn-yellow) !important;
font-weight: 700;
font-size: 1.2rem;
}
/* Product Cards */
.woocommerce ul.products li.product {
background-color: var(--dxn-dark);
border: 1px solid #333;
border-radius: 8px;
transition: transform 0.3s ease;
}
.woocommerce ul.products li.product:hover {
transform: translateY(-5px);
border-color: var(--dxn-red);
}
/* Checkout Form */
.woocommerce-checkout .form-row label {
color: var(--dxn-silver);
font-weight: 500;
}
.woocommerce-checkout .form-row input,
.woocommerce-checkout .form-row select {
background-color: #222;
border: 1px solid #444;
color: #fff;
border-radius: 4px;
}
.woocommerce-checkout .form-row input:focus {
border-color: var(--dxn-red);
outline: none;
}
/* WhatsApp Button Specifics */
.whatsapp-btn {
background-color: #25D366 !important;
color: white !important;
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
width: 100%;
padding: 15px;
font-size: 1.1rem;
}
.whatsapp-btn:hover {
background-color: #1ebc57 !important;
}
Guide d'Exportation (Amana/Ghazala)
Pour exporter la liste de livraison quotidienne au format Excel/CSV compatible avec les courriers marocains :
1. Allez dans WooCommerce > Commandes.
2. Cliquez sur "Exporter" (en haut).
3. Sélectionnez les colonnes suivantes :
- ID Commande
- Date
- Prénom Nom (Billing First Name + Last Name)
- Téléphone (Billing Phone)
- Ville (Billing City)
- Adresse (Billing Address 1)
- Total Commande
4. Cliquez sur "Générer le CSV".
2. Cliquez sur "Exporter" (en haut).
3. Sélectionnez les colonnes suivantes :
- ID Commande
- Date
- Prénom Nom (Billing First Name + Last Name)
- Téléphone (Billing Phone)
- Ville (Billing City)
- Adresse (Billing Address 1)
- Total Commande
4. Cliquez sur "Générer le CSV".
Astuce Pro : Plugin "Order Export & More"
Installez le plugin gratuit "Order Export & More for WooCommerce". Il permet de créer un modèle d'export personnalisé nommé "Livraison Maroc" qui ne contient QUE les champs nécessaires (Nom, Tél, Ville, Adresse, Article), prêt à être envoyé à Amana par email.
Aperçu Produit & Checkout
NEUF
BMW SERIES 3 (E90/E91)
Turbocompresseur Garrett
4,500 MAD
SKU: BMW-TB-001
COMMANDER VIA WHATSAPP
Paiement à la livraison (Cash on Delivery)