/*
 Theme Name:   Woodmart Child
 Description:  Woodmart Child Theme
 Author:       XTemos
 Author URI:   http://xtemos.com
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
*/

/* HERMES_REPLY_TO_OVERRIDE: 客户点“回复”时进到能收信的邮箱，发件地址保持不变(SPF 仍对齐) */
add_filter( 'woocommerce_email_headers', function( $headers, $email_id, $order = null ) {
    $reply = 'PouchGroup Support <support@pouchgroup.com>';
    if ( is_array( $headers ) ) {
        $headers['Reply-To'] = $reply;
    } else {
        $headers .= "Reply-To: " . $reply . "\r\n";
    }
    return $headers;
}, 20, 3 );

/* HERMES_COUPON_FORM: 主题没有输出优惠码输入框，这里用 WooCommerce 原生模板补回（购物车 + 结账） */
add_action( 'woocommerce_before_cart', function () {
    if ( function_exists( 'WC' ) && WC()->cart && ! WC()->cart->is_empty() ) {
        echo '<div class="hermes-coupon-wrap" style="margin:0 0 24px;">';
        wc_get_template( 'cart/cart-coupon.php' );
        echo '</div>';
    }
}, 10 );

add_action( 'woocommerce_checkout_before_customer_details', function () {
    if ( function_exists( 'WC' ) && WC()->cart && ! WC()->cart->is_empty() ) {
        echo '<div class="hermes-coupon-wrap" style="margin:0 0 24px;">';
        wc_get_template( 'checkout/form-coupon.php' );
        echo '</div>';
    }
}, 5 );
