Skip to content

Commit

Permalink
Add support of "Gift Up!" plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
aait committed Sep 6, 2020
1 parent 302d833 commit 87279ea
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions includes/abstracts/abstract-wc-payment-gateway-reepay.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,26 @@ public function get_order_items($order) {
);
}

// Add "Gift Up!" discount
if ( defined( 'GIFTUP_ORDER_META_CODE_KEY' ) &&
defined( 'GIFTUP_ORDER_META_REQUESTED_BALANCE_KEY' )
) {
if ( $order->meta_exists(GIFTUP_ORDER_META_CODE_KEY) ) {
$code = $order->get_meta( GIFTUP_ORDER_META_CODE_KEY );
$requested_balance = $order->get_meta( GIFTUP_ORDER_META_REQUESTED_BALANCE_KEY );

if ( $requested_balance > 0 ) {
$items[] = array(
'ordertext' => sprintf( __( 'Gift card (%s)', 'woocommerce-gateway-reepay-checkout' ), $code ),
'quantity' => 1,
'amount' => round(-100 * $requested_balance ),
'vat' => 0,
'amount_incl_vat' => $pricesIncludeTax
);
}
}
}

return $items;
}

Expand Down

0 comments on commit 87279ea

Please sign in to comment.