2016-11-04 17 views
0

WC Integration Classで私のwoocommerceテーマの設定ページを作成しました。しかし、今私はどのように格納された設定にアクセスできますか?私はそれに関する情報を見つけることができませんか、私は盲目ですか?WoCommerce WC Integrationで保存されたデータにアクセスするにはどうすればよいですか?

私がこれまでに考え出した何を:私はここに配列として私の設定を発見した

// in single product site 
global $woocommerce; 
print_r($woocommerce); 

$woocommerce->integrations->integrations['integration-my_theme_name']->settings

しかし、私は、これは正しい方法だとは思いませんデータを取得します。私はそれのための機能が存在すると思いますか?

{my-used-integration-id}は、統合クラスで使用 idある
$my_settings = get_option('woocommerce_{my-used-integration-id}_settings'); 

答えて

0

[OK]を、私は受け入れ可能な解決策を発見しました。


例:統合クラス(Implementing the WC Integration Class)の

パート:その後、

// Integration 
class WC_Integration_Demo_Integration extends WC_Integration { 

    public function __construct() { 
     global $woocommerce; 
     $this->id     = 'foo-bar'; 

     ... 

以降、この設定にアクセス:今すぐ

$my_settings = get_option('woocommerce_foo-bar_settings'); 

$my_settingsが配列でありますそれはあなたすべてを含んでいます定義されたフィールドと値。

関連する問題