Fix for WooCommerce2 + where get_product cant return an instance of WC_Product and the property to hold the ID is in lowercase. This causes the property to not correct set.
When the property isn't correct set it breaks the magic method __get ( which in turn stops the correct return values of calls to SKU or any other meta. This includes updating stock ).
This commit is contained in:
parent
cde4947acf
commit
f238fe7066
|
@ -35,9 +35,12 @@ class WC_Product {
|
|||
$product = get_product( $product );
|
||||
}
|
||||
|
||||
if ( is_object( $product ) ) {
|
||||
if ( $product instanceof WP_Post ) {
|
||||
$this->id = absint( $product->ID );
|
||||
$this->post = $product;
|
||||
} elseif ( $product instanceof WC_Product ) {
|
||||
$this->id = absint( $product->id );
|
||||
$this->post = $product;
|
||||
} else {
|
||||
$this->id = absint( $product );
|
||||
$this->post = get_post( $this->id );
|
||||
|
|
Loading…
Reference in New Issue