Closed cristianorevil closed 2 years ago
Hello @cristianorevil!
I think you refer to WC_Product_Variable::get_available_variations
.
https://github.com/woocommerce/woocommerce/blob/5.9.0/includes/class-wc-product-variable.php#L289
Yes exact. Is not recognized from intelliphpense
$ grep 'function get_available_variations' woocommerce-stubs.php
public function get_available_variations($return = 'array')
Do you have the same result on your computer? Latest release: v5.9.0
Maybe your variable is of type WC_Product
...
yes i have the same output on my computer (the functions is present in file woocommerce-stubs.php line 28454)
And yes the viariable is type WC_Product (result of wc_get_product($product_id))
All right! Then this is a design problem.
You could force the type if it is surely WC_Product_Variable
.
/** @var \WC_Product_Variable $variable */
$variable = wc_get_product($product_id);
The functions get_available_variations and get_variation_price used when a product is variable is not recognized: "Undefined method" form intelliphpense