<?php

namespace Simplyin\Simplyin_W_Plugin\Hooks\Shop_Frontend;

use WC_Order;

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

class My_Account {

	public function init() {
		add_action( 'woocommerce_order_details_after_customer_details',
			[ $this, 'addCustomStringToOrderDetailsCustomer' ],
			10,
			1 );
	}

	public function addCustomStringToOrderDetailsCustomer( $order ) {
		if ( ! $order instanceof WC_Order ) {
			return;
		}

		$billing_tax_id = $order->get_meta( '_billing_tax_id_simply', true );

		if ( empty( $billing_tax_id ) ) {
			return;
		}

		printf(
			'<div class="woocommerce-customer-details--tax-id"><strong>%s:</strong> %s</div>',
			esc_html( SimplyInTaxIdFieldTranslate( 'Tax ID' ) ),
			esc_html( $billing_tax_id )
		);
	}
}
