Merge pull request #13507 from woocommerce/fix-13506

Validate the parent order ID by calling wc_get_order()
This commit is contained in:
Mike Jolley 2017-03-08 16:05:17 +00:00 committed by GitHub
commit 62240c6bbd
1 changed files with 1 additions and 1 deletions

View File

@ -452,7 +452,7 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
* @throws WC_Data_Exception
*/
public function set_parent_id( $value ) {
if ( $value && ! get_post( $value ) ) {
if ( $value && ! wc_get_order( $value ) ) {
$this->error( 'order_invalid_parent_id', __( 'Invalid parent ID', 'woocommerce' ) );
}
$this->set_prop( 'parent_id', absint( $value ) );