mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Rename fees session to avoid naming conflicts
This commit is contained in:
parent
beafb7b56b
commit
cc87fb50a3
3 changed files with 22 additions and 16 deletions
|
@ -57,18 +57,22 @@ class ItemFactory {
|
|||
$cart->get_cart_contents()
|
||||
);
|
||||
|
||||
$fees = array_map(
|
||||
static function ( \stdClass $fee ) use ( $currency ): Item {
|
||||
return new Item(
|
||||
$fee->name,
|
||||
new Money( (float) $fee->amount, $currency ),
|
||||
1,
|
||||
'',
|
||||
new Money( (float) $fee->tax, $currency )
|
||||
);
|
||||
},
|
||||
WC()->session->get( 'fees' )
|
||||
);
|
||||
$fees = array();
|
||||
$fees_from_session = WC()->session->get( 'ppcp_fees' );
|
||||
if ( $fees_from_session ) {
|
||||
$fees = array_map(
|
||||
static function ( \stdClass $fee ) use ( $currency ): Item {
|
||||
return new Item(
|
||||
$fee->name,
|
||||
new Money( (float) $fee->amount, $currency ),
|
||||
1,
|
||||
'',
|
||||
new Money( (float) $fee->tax, $currency )
|
||||
);
|
||||
},
|
||||
$fees_from_session
|
||||
);
|
||||
}
|
||||
|
||||
return array_merge( $items, $fees );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue