Automattic\WooCommerce\Admin\Features\Blueprint\Exporters
ExportWCPaymentGateways{}└─ StepExporter
Deprecated since 11.2.0 Payment settings are no longer included in Blueprint exports.. It is no longer supported and may be removed in future releases. It is recommended to replace this function with the same one.
Legacy payment gateways exporter.
No Hooks.
Usage
$ExportWCPaymentGateways = new ExportWCPaymentGateways(); // use class methods
Methods
- public check_step_capabilities()
- public export()
- public get_description()
- public get_label()
- public get_step_name()
- public get_wc_payment_gateways()
- protected maybe_hide_wcpay_gateways()
Changelog
| Deprecated since 11.2.0 | Payment settings are no longer included in Blueprint exports. |
ExportWCPaymentGateways{} ExportWCPaymentGateways{} code WC 11.3.0
class ExportWCPaymentGateways implements StepExporter {
/**
* Payment gateway IDs to exclude from export
*
* @var array|string[] Payment gateway IDs to exclude from export
*/
protected array $exclude_ids = array( 'pre_install_woocommerce_payments_promotion' );
/**
* Export the step
*
* @return Step
*/
public function export(): Step {
return new SetSiteOptions();
}
/**
* Return the payment gateways resgietered in WooCommerce
*
* @return string
*/
public function get_wc_payment_gateways() {
return WC()->payment_gateways->payment_gateways();
}
/**
* Get the step name
*
* @return string
*/
public function get_step_name() {
return 'wcPaymentGateways';
}
/**
* Maybe hide WooCommerce Payments gateways
*
* @return void
*/
protected function maybe_hide_wcpay_gateways() {
if ( class_exists( 'WC_Payments' ) ) {
\WC_Payments::hide_gateways_on_settings_page();
}
}
/**
* Return label used in the frontend.
*
* @return string
*/
public function get_label() {
return __( 'Payments', 'woocommerce' );
}
/**
* Return description used in the frontend.
*
* @return string
*/
public function get_description() {
return __( 'Payment settings are not included in Blueprint exports.', 'woocommerce' );
}
/**
* Check if the current user has the required capabilities for this step.
*
* @return bool True if the user has the required capabilities. False otherwise.
*/
public function check_step_capabilities(): bool {
return current_user_can( 'manage_woocommerce' );
}
}