Skip to content

Commit

Permalink
PRESS4-56 Register necessary options with WP
Browse files Browse the repository at this point in the history
  • Loading branch information
aulisius committed Aug 3, 2022
1 parent 3d40b82 commit 4f22a38
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions includes/ECommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ class ECommerce {
'NewfoldLabs\\WP\\Module\\ECommerce\\RestApi\\UserController',
);

protected $options = array(
'nfd-ecommerce-captive-flow-paypal',
'nfd-ecommerce-captive-flow-shippo',
'woocommerce_store_address',
'woocommerce_store_address_2',
'woocommerce_store_city',
'woocommerce_store_postcode',
'woocommerce_default_country',
'wc_connect_taxes_enabled',
'woocommerce_calc_taxes'
);

/**
* ECommerce constructor.
* @param $container
Expand All @@ -41,6 +53,18 @@ public function register_routes() {
$instance = new $Controller();
$instance->register_routes();
}
$this->register_settings();
}

public function register_settings() {
$option_settings = array(
'show_in_rest' => true,
'type' => 'string',
'description' => __( 'NFD eCommerce Options', 'wp-module-ecommerce' ),
);
foreach ($this->options as $option) {
\register_setting( 'general', $option, $option_settings );
}
}

/**
Expand Down

0 comments on commit 4f22a38

Please sign in to comment.