• Very good plugin, easy to install and use. Perhaps it would be interesting to be able to personalize the appearance to highlight this information? And above all, above all, would it be possible to display it on the order in the backoffice please? Thanks again.

Viewing 1 replies (of 1 total)
  • Plugin Support tograczyk

    (@tograczyk)

    Hi @iziaweb

    We have verified the possibilities of introducing the Cart Weight feature in the back-office. Our developers prepared a code you can implement in your functions.php file.

    
    add_action( 'woocommerce_admin_order_totals_after_total', function ( $order_id ) {
        $order_weight = 0.0;
        try {
            $order = wc_get_order( $order_id );
            foreach ( $order->get_items() as $item ) {
                try {
                    $product      = $item->get_product();
                    $order_weight += $product->get_weight() * $item->get_quantity();
                } catch (Exception $e) {
                    // do nothing.
                }
            }
        } catch (Exception $e) {
            // do nothing.
        }
    
        if ( $order_weight === 0.0 ) {
            return;
        }
        ?>
            <tr>
                <td colspan="3"><hr/></td>
            </tr>
            <tr>
                <td class="label"><?php esc_html_e( 'Weight', 'woocommerce' ); ?>:</td>
                <td width="1%"></td>
                <td class="total">
                    <span class="amount">
                        <?php echo wc_format_weight( $order_weight ); ?>
                    </span>
                </td>
            </tr>
        <?php
    } );
    
    

    Please use this article for reference: https://octolize.com/blog/add-custom-code-woocommerce-and-wordpress/.

    If you have additional questions, please open a new support thread or contact us at https://octolize.com/support/

    Thank you for the review!

Viewing 1 replies (of 1 total)
  • The topic ‘Works fine and simple, many too much simple’ is closed to new replies.