Last active
August 1, 2020 22:42
-
-
Save darrylmorley/789db0e9b5657d66eb775d872edfac31 to your computer and use it in GitHub Desktop.
Delete Object Using CRUD #woocommerce
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Delete an object, set the ID to 0, and return result. | |
* | |
* @param bool $force_delete | |
* @return bool result | |
*/ | |
public function delete( $force_delete = false ) { | |
// Trigger action before deleting from DB. Allows you to adjust some related object props before delete. | |
do_action( 'woocommerce_before_' . $this->object_type . '_object_delete', $this, $this->data_store ); | |
if ( $this->data_store ) { | |
$this->data_store->delete( $this, array( 'force_delete' => $force_delete ) ); | |
$this->set_id( 0 ); | |
return true; | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment