Automattic\WooCommerce\Admin\Features\Blueprint\Importers
ImportSetWCPaymentGateways::process()
Process the import of WooCommerce payment gateways settings.
Метод класса: ImportSetWCPaymentGateways{}
Хуки из метода
Возвращает
StepProcessorResult
.
Использование
$ImportSetWCPaymentGateways = new ImportSetWCPaymentGateways(); $ImportSetWCPaymentGateways->process( $schema ): StepProcessorResult;
- $schema(объект) (обязательный)
- The schema object containing import details.
Код ImportSetWCPaymentGateways::process() ImportSetWCPaymentGateways::process WC 9.7.1
public function process( $schema ): StepProcessorResult { $result = StepProcessorResult::success( SetWCPaymentGateways::get_step_name() ); $payment_gateways = $this->get_wc_payment_gateways(); $fields = array( 'title', 'description', 'enabled' ); foreach ( $schema->payment_gateways as $id => $payment_gateway_data ) { if ( ! isset( $payment_gateways[ $id ] ) ) { $result->add_info( "Skipping {$id}. The payment gateway is not available" ); continue; } $payment_gateway = $payment_gateways[ $id ]; // Refer to https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/includes/class-wc-ajax.php#L3564. foreach ( $fields as $field ) { if ( isset( $payment_gateway_data->{$field} ) ) { $payment_gateway->update_option( $field, $payment_gateway_data->{$field} ); } } $result->add_info( "{$id} has been updated." ); $this->wp_do_action( 'woocommerce_update_options' ); } return $result; }