[COT] Restore refund removal functionality when COT is active (#34785)
Change `get_post_type()` call in refund removal code to use COT APIs
This commit is contained in:
parent
7b55c334ad
commit
f826c4bf55
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: fix
|
||||
|
||||
Fix order refund removal when the HPOS datastore is in use.
|
|
@ -11,6 +11,7 @@ use Automattic\WooCommerce\Internal\Orders\CouponsController;
|
|||
use Automattic\WooCommerce\Internal\Orders\TaxesController;
|
||||
use Automattic\WooCommerce\Internal\Admin\Orders\MetaBoxes\CustomMetaBox;
|
||||
use Automattic\WooCommerce\Utilities\NumberUtil;
|
||||
use Automattic\WooCommerce\Utilities\OrderUtil;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
|
@ -1959,7 +1960,7 @@ class WC_AJAX {
|
|||
|
||||
$refund_ids = array_map( 'absint', is_array( $_POST['refund_id'] ) ? wp_unslash( $_POST['refund_id'] ) : array( wp_unslash( $_POST['refund_id'] ) ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
foreach ( $refund_ids as $refund_id ) {
|
||||
if ( $refund_id && 'shop_order_refund' === get_post_type( $refund_id ) ) {
|
||||
if ( $refund_id && 'shop_order_refund' === OrderUtil::get_order_type( $refund_id ) ) {
|
||||
$refund = wc_get_order( $refund_id );
|
||||
$order_id = $refund->get_parent_id();
|
||||
$refund->delete( true );
|
||||
|
|
Loading…
Reference in New Issue