製品のバリエーションIDを書いているプラグインを取得しようとしています。ここに私が書いたものがあります:
class mass {
public function __construct()
{
add_action('woocommerce_product_after_variable_attributes',array($this,'thfo_mass'));
}
public function thfo_mass()
{
$id = WC_Product_Variation::get_variation_id();
//$lenght = get_post_meta($id,'_length');
//$dimensions = wc_get_dimension(24750, 'cm');
var_dump($id);
}
エラーが発生するだけです:
非推奨: 非静的メソッド WC_Product_Variation::get_variation_id() は、19 行目の path/to/plugins/thfo-raw-material-for-woocommerce/class/mass.php の互換性のないコンテキストから $this を想定して、静的に呼び出すべきではありません
注意: 未定義のプロパティ: mass::$variation_id in path/to/wp-content/plugins/woocommerce/includes/class-wc-product-variation.php 行 257 int(0)