id = 'aisp_phoneorder'; // translators: Admin title of the payment method in WooCommerce settings. $this->method_title = __( 'Phone Order', 'aisp-order-tools-for-woocommerce' ); // translators: Description of the payment method shown in WooCommerce settings. $this->method_description = __( 'Allow customers to place an order without paying immediately. The order will be marked as pending payment.', 'aisp-order-tools-for-woocommerce' ); $this->has_fields = false; $this->supports = array( 'products' ); $this->init_form_fields(); $this->init_settings(); // translators: Title of the payment method displayed to the customer during checkout. $this->title = $this->get_option( 'title', __( 'Phone Order', 'aisp-order-tools-for-woocommerce' ) ); // translators: Description shown below the payment option during checkout. $this->description = $this->get_option( 'description', __( 'Place your order now and pay later by phone or email.', 'aisp-order-tools-for-woocommerce' ) ); $this->enabled = $this->get_option( 'enabled', 'yes' ); add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); } public function init_form_fields() { $this->form_fields = array( 'enabled' => array( // translators: Checkbox label for enabling/disabling the Phone Order payment gateway. 'title' => __( 'Enable/Disable', 'aisp-order-tools-for-woocommerce' ), 'type' => 'checkbox', // translators: Checkbox description label in WooCommerce settings. 'label' => __( 'Enable Phone Order', 'aisp-order-tools-for-woocommerce' ), 'default' => 'yes', ), 'title' => array( // translators: Field label for the title displayed to customers. 'title' => __( 'Title', 'aisp-order-tools-for-woocommerce' ), 'type' => 'text', // translators: Help text describing what the title field controls. 'description' => __( 'The title the customer will see during checkout.', 'aisp-order-tools-for-woocommerce' ), // translators: Default value for the title field. 'default' => __( 'Phone Order', 'aisp-order-tools-for-woocommerce' ), 'desc_tip' => true, ), 'description' => array( // translators: Field label for the description displayed under the payment option. 'title' => __( 'Description', 'aisp-order-tools-for-woocommerce' ), 'type' => 'textarea', // translators: Help text describing what the description field controls. 'description' => __( 'The message displayed below the payment option during checkout.', 'aisp-order-tools-for-woocommerce' ), // translators: Default text for the description shown to customers. 'default' => __( 'Place your order now and pay later by phone or email.', 'aisp-order-tools-for-woocommerce' ), 'desc_tip' => true, ), ); } public function process_payment( $order_id ) { $order = wc_get_order( $order_id ); // translators: Order note when a customer uses the Phone Order payment method. $order->update_status( 'pending', __( 'Awaiting payment (Phone Order).', 'aisp-order-tools-for-woocommerce' ) ); return array( 'result' => 'success', 'redirect' => $this->get_return_url( $order ), ); } }