Ensure _stock meta exists, or update will fail
This commit is contained in:
parent
70ef82a617
commit
4d2378087e
|
@ -398,6 +398,9 @@ class WC_Product_Variation extends WC_Product {
|
||||||
$this->variation_has_stock = true;
|
$this->variation_has_stock = true;
|
||||||
$this->manage_stock = 'yes';
|
$this->manage_stock = 'yes';
|
||||||
|
|
||||||
|
// Ensure _stock exists
|
||||||
|
add_post_meta( $this->variation_id, '_stock', '', true );
|
||||||
|
|
||||||
// Update stock in DB directly
|
// Update stock in DB directly
|
||||||
switch ( $mode ) {
|
switch ( $mode ) {
|
||||||
case 'add' :
|
case 'add' :
|
||||||
|
|
Loading…
Reference in New Issue