woocommerce_checkout_order_processed

ACTION woocommerce\includes\class-wc-checkout.php (ligne 1352) github
Process the checkout after the confirm order button is pressed.
traduction française
Procéder au paiement après avoir appuyé sur le bouton de confirmation de la commande.

Paramètres

Entrée :
$order_id, $posted_data, $order
Sortie :
N/A

Utilisation

Action après traitement de la commande au checkout

Exécuter du code juste après la création de la commande

order-flow
// Action après traitement de la commande
add_action('woocommerce_checkout_order_processed', 'apres_creation_commande', 10, 3);

function apres_creation_commande($order_id, $posted_data, $order) {
    // Sauvegarder des données personnalisées
    if (isset($posted_data['custom_field'])) {
        update_post_meta($order_id, '_custom_field', sanitize_text_field($posted_data['custom_field']));
    }
    
    // Envoyer à un CRM externe
    // Générer un ticket support
}

Actualités

Chargement des actualités...