Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
PHP Warnings when creating a variable product programmatically #16653
I'm getting PHP warnings with Woocommerce 3.1.2 when creating a variable product programmatically:
$product = new WC_Product_Variable();
When I follow those steps, I see in the PHP error log:
The problem is on the is_on_sale function, which is called on save, when trying to call the get_variation_prices function, which doesn't return the regular_price or sale_price because it still doesn't have variation products assigned.
added a commit
Aug 31, 2017
That function does return those values. Even if there are no variations, the array keys are set here before passing to a transient.
Maybe you have something else changing these values via the filter. Possibly extension.
I've adding a unit test to prove core is not at fault. The array values exist, and the ID is set without a notice being thrown. As long as that test passes, we're good.