WooFrance Dépannage et support WordPress WooCommerce Forums Forum de Support WooCommerce WooCommerce, ajouter “Nombre total d'article”

3 sujets de 1 à 3 (sur un total de 3)
  • Auteur
    Messages
  • #5909
    Klø DBR
    Participant
    Points: 19 pts

    Bonsoir la communauté,

    Je viens souvent ici pour vous lire mais jamais pour poser des questions. Mais maintenant, j’ai besoin d’aide car je ne trouve pas ce que je veux.

    Je m’explique, mon client souhaite avoir dans le mail qu’il reçoit intitulé “ Nouvelle commande ”

    Au niveau de cet endroit, ajouter une colonne “ nombre total d’article vendu ”. Il doit bien y avoir une ligne de code qui existe mais je ne trouve vraiment pas.

    Merci à vous.

    depanagewp
    #5912
    Mathieu
    Participant
    Points: 1,315 pts
    Membre 2 étoiles

    Vous pouvez personnaliser le contenu de cet e-mail dans le fichier emails/email-order-details.php.

    Et pour connaitre le nombre de produits c’est ce code :
    $nombre = $order->get_item_count( apply_filters( 'woocommerce_admin_order_item_types', 'line_item' ) );

    Développeur PHP et WordPress En Alsace dans l'annuaire des prestataires WordPress et WooCommerce
    Création d'extensions pour WordPress et WooCommerce - Personnalisation d'extensions existantes
    🔶 Si vous appréciez mon aide, vous pouvez me faire un don de n'importe quel montant en cliquant ici.

    depanagewp
    #5925
    Klø DBR
    Participant
    Points: 19 pts

    Merci Mathieu pour votre réponse, alors j’ai bien trouvé le fichier mais je ne sais pas où le placer…
    <?php
    /**
    * Order details table shown in emails.
    *
    * This template can be overridden by copying it to yourtheme/woocommerce/emails/email-order-details.php.
    *
    * HOWEVER, on occasion WooCommerce will need to update template files and you
    * (the theme developer) will need to copy the new files to your theme to
    * maintain compatibility. We try to do this as little as possible, but it does
    * happen. When this occurs the version of the template file will be bumped and
    * the readme will list any important changes.
    *
    * @see https://docs.woocommerce.com/document/template-structure/
    * @author WooThemes
    * @package WooCommerce/Templates/Emails
    * @version 3.0.0
    */

    if ( ! defined( 'ABSPATH' ) ) {
    exit;
    }

    $text_align = is_rtl() ? 'right' : 'left';

    do_action( 'woocommerce_email_before_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>

    <?php if ( ! $sent_to_admin ) : ?>

    <?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?>

    <?php else : ?>

    get_id() . '&action=edit' ) ); ?>"><?php printf( __( 'Order #%s', 'woocommerce' ), $order->get_order_number() ); ?> (<?php printf( '<time datetime="%s">%s</time>', $order->get_date_created()->format( 'c' ), wc_format_datetime( $order->get_date_created() ) ); ?>)

    <?php endif; ?>

    <?php echo wc_get_email_order_items( $order, array(
    'show_sku' => $sent_to_admin,
    'show_image' => false,
    'image_size' => array( 32, 32 ),
    'plain_text' => $plain_text,
    'sent_to_admin' => $sent_to_admin,
    ) ); ?>
    <?php
    if ( $totals = $order->get_order_item_totals() ) {
    $i = 0;
    foreach ( $totals as $total ) {
    $i++;
    ?>

    <?php
    }
    }
    ?>

    ;"><?php _e( 'Product', 'woocommerce' ); ?> ;"><?php _e( 'Quantity', 'woocommerce' ); ?> ;"><?php _e( 'Price', 'woocommerce' ); ?>
    ; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['label']; ?> ; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>"><?php echo $total['value']; ?>

    <?php do_action( 'woocommerce_email_after_order_table', $order, $sent_to_admin, $plain_text, $email ); ?>

    depanagewp
    1 utilisateur a remercié l'auteur de ce message.
3 sujets de 1 à 3 (sur un total de 3)
  • Vous devez être connecté pour répondre à ce sujet.