Skip to content

Commit

Permalink
remove redundant filter line item coupon
Browse files Browse the repository at this point in the history
  • Loading branch information
kzamanbd committed Feb 4, 2025
1 parent 7998839 commit 3eec95a
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions includes/Vendor/Coupon.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,9 @@ public function save_item_coupon_discount( WC_Coupon $coupon, WC_Discounts $disc
*/
protected function save_coupon_data_to_cart_item( WC_Coupon $coupon, WC_Discounts $discounts, $item ): void {
$cart = WC()->cart;
$coupon_codes = $cart->get_applied_coupons();
$item_key = $item->object['key'];
$item_object = $cart->cart_contents[ $item_key ];

$coupon_info = $item_object[ self::DOKAN_COUPON_META_KEY ] ?? [];
$coupon_info = array_filter(
$coupon_info,
function ( $coupon_temp ) use ( $coupon_codes ) {
return in_array( $coupon_temp['coupon_code'], $coupon_codes, true );
}
);

$item_wise_discounts = $discounts->get_discounts();

Expand Down

0 comments on commit 3eec95a

Please sign in to comment.