WordPress at a glance
function is not described

WC_Coupon_Data_Store_CPT::delete() public WC 3.0.0

Deletes a coupon from the database.

{} It's a method of the class: WC_Coupon_Data_Store_CPT{}

Return

null. Nothing.

Usage

$WC_Coupon_Data_Store_CPT = new WC_Coupon_Data_Store_CPT();
$WC_Coupon_Data_Store_CPT->delete( $coupon, $args );
$coupon(WC_Coupon) (required)
Coupon object.
$args(array)
Array of args to pass to the delete method.

Changelog

Since 3.0.0 Introduced.

Code of WC_Coupon_Data_Store_CPT::delete() WC 5.3.0

<?php
public function delete( &$coupon, $args = array() ) {
	$args = wp_parse_args(
		$args,
		array(
			'force_delete' => false,
		)
	);

	$id = $coupon->get_id();

	if ( ! $id ) {
		return;
	}

	if ( $args['force_delete'] ) {
		wp_delete_post( $id );

		wp_cache_delete( WC_Cache_Helper::get_cache_prefix( 'coupons' ) . 'coupon_id_from_code_' . $coupon->get_code(), 'coupons' );

		$coupon->set_id( 0 );
		do_action( 'woocommerce_delete_coupon', $id );
	} else {
		wp_trash_post( $id );
		do_action( 'woocommerce_trash_coupon', $id );
	}
}