When sending the order as a whole to paypal, send the shipping separately.. Closes #976.
This commit is contained in:
parent
421273f4c7
commit
375d973128
|
@ -291,6 +291,11 @@ class WC_Order {
|
|||
return $this->order_shipping;
|
||||
}
|
||||
|
||||
/** Gets shipping tax amount */
|
||||
function get_shipping_tax() {
|
||||
return $this->order_shipping_tax;
|
||||
}
|
||||
|
||||
/** Gets order total */
|
||||
function get_order_total() {
|
||||
return $this->order_total;
|
||||
|
|
|
@ -234,6 +234,7 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
// Payment Info
|
||||
'invoice' => $order->order_key
|
||||
|
||||
),
|
||||
$phone_args
|
||||
);
|
||||
|
@ -258,7 +259,7 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
$paypal_args['no_shipping'] = 1;
|
||||
}
|
||||
|
||||
// If prices include tax or have order discounts, send the whole order
|
||||
// If prices include tax or have order discounts, send the whole order as a single item
|
||||
if ( get_option('woocommerce_prices_include_tax')=='yes' || $order->get_order_discount() > 0 ) :
|
||||
|
||||
// Discount
|
||||
|
@ -273,14 +274,16 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
|
||||
$paypal_args['item_name_1'] = sprintf( __('Order %s' , 'woocommerce'), $order->get_order_number() ) . " - " . implode(', ', $item_names);
|
||||
$paypal_args['quantity_1'] = 1;
|
||||
$paypal_args['amount_1'] = number_format($order->get_order_total() - $order->get_shipping() + $order->get_order_discount(), 2, '.', '');
|
||||
$paypal_args['amount_1'] = number_format($order->get_order_total() - $order->get_shipping() - $order->get_shipping_tax() + $order->get_order_discount(), 2, '.', '');
|
||||
|
||||
// Shipping Cost
|
||||
if ($order->get_shipping()>0) :
|
||||
$paypal_args['shipping_1'] = number_format( $order->get_shipping() + $order->get_shipping_tax() , 2, '.', '' );
|
||||
|
||||
/*if ( $order->get_shipping() > 0 ) :
|
||||
$paypal_args['item_name_2'] = __('Shipping via', 'woocommerce') . ' ' . ucwords($order->shipping_method_title);
|
||||
$paypal_args['quantity_2'] = '1';
|
||||
$paypal_args['amount_2'] = number_format($order->get_shipping(), 2, '.', '');
|
||||
endif;
|
||||
endif;*/
|
||||
|
||||
else :
|
||||
|
||||
|
@ -311,7 +314,7 @@ class WC_Paypal extends WC_Payment_Gateway {
|
|||
endif;
|
||||
endforeach; endif;
|
||||
|
||||
// Shipping Cost
|
||||
// Shipping Cost item - paypal only allows shipping per item, we want to send shipping for the order
|
||||
if ($order->get_shipping()>0) :
|
||||
$item_loop++;
|
||||
$paypal_args['item_name_'.$item_loop] = __('Shipping via', 'woocommerce') . ucwords($order->shipping_method_title);
|
||||
|
|
|
@ -154,7 +154,8 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
|||
* Tweak - Changed category and tag link to filter product list in admin panel
|
||||
* Tweak - Removed product 'exists' variable in favour of the exists() method. Tweaked exist method to look for ID in DB.
|
||||
* Tweak - Only use rm=2 for paypal when SSL is enabled, to avoid security warnings when returning to the site.
|
||||
* Tweak - Show sku in stock reports
|
||||
* Tweak - Show sku in stock reports.
|
||||
* Tweak - When sending the order as a whole to paypal, send the shipping separately.
|
||||
* Fix - Replacing use of deprecated function get_current_theme() with wp_get_theme()
|
||||
* Fix - Body classes now correct for WordPress themes with non alphanumeric characters
|
||||
* Fix - PayPal http_build_query & -> & on some PHP 5.3 servers
|
||||
|
|
Loading…
Reference in New Issue