Plugin Directory

Changeset 1023219


Ignore:
Timestamp:
11/10/2014 05:43:47 PM (11 years ago)
Author:
patrickgarman
Message:

v1.1.0 - Add Shipping Discount

Location:
wc-ebay-enterprise-affiliates/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wc-ebay-enterprise-affiliates/trunk/readme.txt

    r1019003 r1023219  
    55Requires at least: 3.0
    66Tested up to: 4.0
    7 Stable tag: 1.0.1
     7Stable tag: 1.1.0
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    2121== Changelog ==
    2222
     23= 1.1.0 - 11/10/2014 =
     24* Add shipping discount // props @KamikazeXeX
     25
    2326= 1.0.1 - 11/03/2014 =
    2427* Use product ID instead of SKU
  • wc-ebay-enterprise-affiliates/trunk/woocommerce-ebay-enterprise-affiliates.php

    r1019003 r1023219  
    6666            'desc_tip' =>  true,
    6767        );
     68       
     69        $options[] = array(
     70            'title'    => __( 'Shipping Discount', 'wc-ebay' ),
     71            'desc'     => __( 'If shipping is included in your prices, this discount will reduce the totals sent to EEAN so commissions are not paid on included shipping prices.', 'wc-ebay' ),
     72            'id'       => 'woocommerce_ebay_affiliate_shipping_discount',
     73            'default'  => '',
     74            'type'     => 'text',
     75            'desc_tip' =>  true,
     76        );
    6877
    6978        $options[] = array(
     
    119128                 * absint() should always give us a number greater or equal to zero.
    120129                 */
    121                 $item_query_args[ 'TOTALAMOUNT' . $i ] = isset( $item['line_total'] ) ? absint( $item['line_total'] - $individual_discount ) : 0;
     130                $shipping_discount = 1 - ( floatval( WC_Admin_Settings::get_option( 'woocommerce_ebay_affiliate_shipping_discount', 0 ) ) / 100 );
     131                $total = isset( $item['line_total'] ) ? $shipping_discount * ( $item['line_total'] - $individual_discount ) : 0;
     132                $item_query_args[ 'TOTALAMOUNT' . $i ] = 0 < $total ? number_format( $total, 2, '.', '' ) : 0;
    122133            }
    123134        }
Note: See TracChangeset for help on using the changeset viewer.