Home / eCommerce / Add a button to customer data
Duplicate Snippet

Embed Snippet on Your Site

Add a button to customer data

Add a button to retrieve all customer data.

Code Preview
php
<?php
add_action( 'woocommerce_admin_order_data_after_billing_address', 'custom_customer_history_search_button_blue', 10, 1 );
function custom_customer_history_search_button_blue( $order ) {
    // Vásárló e-mail címének lekérése
    $customer_email = $order->get_billing_email();
    if ( $customer_email ) {
        // A keresési URL összeállítása
        $search_url = admin_url( 'edit.php?s=' . urlencode( $customer_email ) . '&post_type=shop_order' );
        // Megjelenítés kék gombbal (button-primary) és ugyanazon az oldalon
        echo '<p><a href="' . esc_url( $search_url ) . '" class="button button-primary" style="margin-top: 10px; display: block; text-align: center; background-color: #007cba; border-color: #007cba;">Vásárló összes rendelése</a></p>';
    }
}

Comments

Add a Comment