Server IP : 172.67.158.161 / Your IP : 18.223.106.79 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/khowordpress.com/wp-content/plugins/woocommerce/src/Blocks/Domain/Services/ |
Upload File : |
<?php use Automattic\WooCommerce\Blocks\Package; use Automattic\WooCommerce\Blocks\Domain\Services\CheckoutFields; if ( ! function_exists( '__experimental_woocommerce_blocks_register_checkout_field' ) ) { /** * Register a checkout field. * * @param array $options Field arguments. See CheckoutFields::register_checkout_field() for details. * @throws \Exception If field registration fails. */ function __experimental_woocommerce_blocks_register_checkout_field( $options ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore // Check if `woocommerce_blocks_loaded` ran. If not then the CheckoutFields class will not be available yet. // In that case, re-hook `woocommerce_blocks_loaded` and try running this again. $woocommerce_blocks_loaded_ran = did_action( 'woocommerce_blocks_loaded' ); if ( ! $woocommerce_blocks_loaded_ran ) { add_action( 'woocommerce_blocks_loaded', function() use ( $options ) { __experimental_woocommerce_blocks_register_checkout_field( $options ); } ); return; } $checkout_fields = Package::container()->get( CheckoutFields::class ); $result = $checkout_fields->register_checkout_field( $options ); if ( is_wp_error( $result ) ) { throw new \Exception( $result->get_error_message() ); } } }