Automattic\WooCommerce\Internal\Features
FeaturesController::add_point_of_sale_setting_for_rest_api
Handler for the 'woocommerce_settings-advanced' hook, which defines the settings exposed in the wc/v3 settings REST API for the 'advanced' group. It appends the Point of Sale feature flag setting.
This is a compatibility shim for the WooCommerce mobile apps: app versions released before the point_of_sale feature became always enabled (deprecated in 11.0.0) read and write this setting via wc/v3/settings/advanced/woocommerce_feature_point_of_sale_enabled to decide whether POS can be used. The setting is no longer rendered in the admin UI; this shim can be removed once those app versions are no longer supported.
Method of the class: FeaturesController{}
No Hooks.
Returns
Array. The updated settings array.
Usage
$FeaturesController = new FeaturesController(); $FeaturesController->add_point_of_sale_setting_for_rest_api( $settings ): array;
- $settings(array) (required)
- The settings of the
'advanced'group, as exposed in the REST API.
FeaturesController::add_point_of_sale_setting_for_rest_api() FeaturesController::add point of sale setting for rest api code WC 11.0.1
public function add_point_of_sale_setting_for_rest_api( $settings ): array {
$settings[] = array(
'id' => 'woocommerce_feature_point_of_sale_enabled',
'option_key' => 'woocommerce_feature_point_of_sale_enabled',
'label' => __( 'Point of Sale', 'woocommerce' ),
'description' => __( 'Enable Point of Sale functionality in the WooCommerce mobile apps.', 'woocommerce' ),
'type' => 'checkbox',
'default' => 'yes',
);
return $settings;
}