Automattic\WooCommerce\Blocks\Domain\Services

CheckoutFieldsFrontend::init()publicWC 1.0

Initialize hooks. This is not run Store API requests.

Method of the class: CheckoutFieldsFrontend{}

No Hooks.

Returns

null. Nothing (null).

Usage

$CheckoutFieldsFrontend = new CheckoutFieldsFrontend();
$CheckoutFieldsFrontend->init();

CheckoutFieldsFrontend::init() code WC 9.8.4

public function init() {
	// Show custom checkout fields on the order details page.
	add_action( 'woocommerce_order_details_after_customer_address', array( $this, 'render_order_address_fields' ), 10, 2 );
	add_action( 'woocommerce_order_details_after_customer_details', array( $this, 'render_order_other_fields' ), 10 );

	// Show custom checkout fields on the My Account page.
	add_action( 'woocommerce_my_account_after_my_address', array( $this, 'render_address_fields' ), 10, 1 );

	// Edit account form under my account (for contact details).
	add_filter( 'woocommerce_edit_account_form_fields', array( $this, 'edit_account_form_fields' ), 10, 1 );
	add_action( 'woocommerce_save_account_details', array( $this, 'save_account_form_fields' ), 10, 1 );

	// Edit address form under my account.
	add_filter( 'woocommerce_address_to_edit', array( $this, 'edit_address_fields' ), 10, 2 );
	add_action( 'woocommerce_customer_save_address', array( $this, 'save_address_fields' ), 10, 4 );
}