Merge pull request #22653 from woocommerce/update/22568
Added `woocommerce_paypal_force_one_line_item` filter
This commit is contained in:
commit
cd7959b59c
|
@ -184,10 +184,16 @@ class WC_Gateway_Paypal_Request {
|
||||||
protected function get_paypal_args( $order ) {
|
protected function get_paypal_args( $order ) {
|
||||||
WC_Gateway_Paypal::log( 'Generating payment form for order ' . $order->get_order_number() . '. Notify URL: ' . $this->notify_url );
|
WC_Gateway_Paypal::log( 'Generating payment form for order ' . $order->get_order_number() . '. Notify URL: ' . $this->notify_url );
|
||||||
|
|
||||||
|
$force_one_line_item = apply_filters( 'woocommerce_paypal_force_one_line_item', false, $order );
|
||||||
|
|
||||||
|
if ( ( wc_tax_enabled() && wc_prices_include_tax() ) || ! $this->line_items_valid( $order ) ) {
|
||||||
|
$force_one_line_item = true;
|
||||||
|
}
|
||||||
|
|
||||||
$paypal_args = apply_filters(
|
$paypal_args = apply_filters(
|
||||||
'woocommerce_paypal_args', array_merge(
|
'woocommerce_paypal_args', array_merge(
|
||||||
$this->get_transaction_args( $order ),
|
$this->get_transaction_args( $order ),
|
||||||
$this->get_line_item_args( $order )
|
$this->get_line_item_args( $order, $force_one_line_item )
|
||||||
), $order
|
), $order
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -297,11 +303,8 @@ class WC_Gateway_Paypal_Request {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function get_line_item_args( $order, $force_one_line_item = false ) {
|
protected function get_line_item_args( $order, $force_one_line_item = false ) {
|
||||||
if ( wc_tax_enabled() && wc_prices_include_tax() || ! $this->line_items_valid( $order ) ) {
|
|
||||||
$force_one_line_item = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
$line_item_args = array();
|
$line_item_args = array();
|
||||||
|
|
||||||
if ( $force_one_line_item ) {
|
if ( $force_one_line_item ) {
|
||||||
/**
|
/**
|
||||||
* Send order as a single item.
|
* Send order as a single item.
|
||||||
|
|
Loading…
Reference in New Issue