It is not accepted yet. We will email you when the restaurant answers, and you can %s.', 'sofrah-order-board' ), '' . esc_html__( 'follow it on its status page', 'sofrah-order-board' ) . '' ); }, 10, 2 ); // No order note: hidden in the block checkout and the classic checkout, and dropped on the server whatever sent it. add_filter( 'render_block_woocommerce/checkout-order-note-block', function ( $html ) { return 'yes' === sofrah_board_setting( 'no_notes' ) ? '' : $html; } ); add_filter( 'woocommerce_enable_order_notes_field', function ( $on ) { return 'yes' === sofrah_board_setting( 'no_notes' ) ? false : $on; } ); add_action( 'woocommerce_before_order_object_save', function ( $order ) { if ( 'yes' === sofrah_board_setting( 'no_notes' ) && $order instanceof WC_Order && ! ( $order instanceof WC_Order_Refund ) && sofrah_board_is_pickup_method( $order->get_payment_method() ) && '' !== (string) $order->get_customer_note( 'edit' ) ) { $order->set_customer_note( '' ); } }, 3 ); // Pickup only: no address fields, phone required. Applies to the block and classic checkout through WooCommerce's address settings. $sofrah_board_short = function ( $fields ) { if ( 'yes' !== sofrah_board_setting( 'short_form' ) ) { return $fields; } foreach ( array( 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ) as $f ) { if ( isset( $fields[ $f ] ) ) { $fields[ $f ]['required'] = false; $fields[ $f ]['hidden'] = true; } } return $fields; }; add_filter( 'woocommerce_default_address_fields', $sofrah_board_short, 99 ); add_filter( 'woocommerce_get_country_locale', function ( $locales ) use ( $sofrah_board_short ) { foreach ( $locales as $cc => $l ) { $locales[ $cc ] = $sofrah_board_short( is_array( $l ) ? $l + array_fill_keys( array( 'company', 'address_1', 'address_2', 'city', 'state', 'postcode' ), array() ) : $l ); } return $locales; }, 99 ); add_filter( 'woocommerce_billing_fields', function ( $fields ) { if ( 'yes' === sofrah_board_setting( 'short_form' ) && isset( $fields['billing_phone'] ) ) { $fields['billing_phone']['required'] = true; } return $fields; }, 99 ); add_filter( 'pre_option_woocommerce_checkout_phone_field', function ( $v ) { return 'yes' === sofrah_board_setting( 'short_form' ) ? 'required' : $v; } );