Changeset 1967283
- Timestamp:
- 11/01/2018 04:15:54 PM (7 years ago)
- Location:
- show-net-revenue-from-woocommerce-stripe-gateway
- Files:
-
- 2 edited
- 3 copied
-
tags/1.1 (copied) (copied from show-net-revenue-from-woocommerce-stripe-gateway/trunk)
-
tags/1.1/readme.txt (copied) (copied from show-net-revenue-from-woocommerce-stripe-gateway/trunk/readme.txt) (2 diffs)
-
tags/1.1/show-net-revenue-from-woocommerce-stripe-gateway.php (copied) (copied from show-net-revenue-from-woocommerce-stripe-gateway/trunk/show-net-revenue-from-woocommerce-stripe-gateway.php) (6 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/show-net-revenue-from-woocommerce-stripe-gateway.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
show-net-revenue-from-woocommerce-stripe-gateway/tags/1.1/readme.txt
r1593398 r1967283 2 2 Contributors: boswall 3 3 Requires at least: 4.6 4 Tested up to: 4.7.2 4 Tested up to: 5.0 5 Stable tag: trunk 5 6 License: GPL-2.0+ 6 7 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 9 10 10 11 == Description == 11 The WooCommerce Stripe Gateway adds extra information to each order about the fee taken and the remaining net revenue. However, it doesn\'t show this anywhere.12 The WooCommerce Stripe Gateway adds extra information to each order about the fee taken and the remaining net revenue. Before v4.0.0 this information is not visible anywhere. After v4.0.0 this is only visible for new orders in the Order page. 12 13 13 This plugin adds two columns to the WooCommerce Order list and below the Order totals on the Order page . Visible by shop admins only.14 This plugin adds two columns to the WooCommerce Order list and below the Order totals on the Order page (on legacy orders). Visible by shop admins only. -
show-net-revenue-from-woocommerce-stripe-gateway/tags/1.1/show-net-revenue-from-woocommerce-stripe-gateway.php
r1593398 r1967283 2 2 /** 3 3 * Plugin Name: Show Net Revenue from WooCommerce Stripe Gateway 4 * Plugin URI: https://github.com/boswall/ show-woostripe-revenue4 * Plugin URI: https://github.com/boswall/Show-Net-Revenue-from-WooCommerce-Stripe-Gateway 5 5 * Description: Shows the Stripe fee and net revenue for Woocommerce order listings in the admin area. 6 * Version: 1. 0.06 * Version: 1.1.0 7 7 * Author: Matt Rose 8 8 * Author URI: http://glaikit.co.uk/ … … 17 17 die; 18 18 } 19 20 // Define our meta keys 21 define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_FEE', 'Stripe Fee' ); 22 define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_NET', 'Net Revenue From Stripe' ); 23 define( 'SHOWWOOSTRIPE_META_NAME_FEE', '_stripe_fee' ); 24 define( 'SHOWWOOSTRIPE_META_NAME_NET', '_stripe_net' ); 25 define( 'SHOWWOOSTRIPE_META_NAME_STRIPE_CURRENCY', '_stripe_currency' ); 19 26 20 27 // Fiters and Actions needed to make everything work. … … 38 45 */ 39 46 function show_woostripe_revenue_admin_order_totals_after_refunded( $order_id ) { 40 if ( $fees = get_post_meta( get_the_ID(), 'Stripe Fee')[0] ) {47 if ( $fees = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_FEE )[0] ) { 41 48 ?> 42 49 … … 50 57 } 51 58 52 if ( $net = get_post_meta( get_the_ID(), 'Net Revenue From Stripe')[0] ) {59 if ( $net = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_NET )[0] ) { 53 60 ?> 54 61 … … 80 87 function show_woostripe_revenue_render_shop_order_columns( $column ) { 81 88 if ( $column == 'order_stripefees' ) { 82 if ( ! $fees = get_post_meta( get_the_ID(), 'Stripe Fee' )[0]) {83 echo '<span class="na">–</span>';89 if ( $fees = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_META_NAME_FEE, true ) ) { 90 echo wc_price( $fees ); 84 91 return; 85 92 } 86 echo wc_price( $fees ); 93 else if ( $fees = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_FEE, true ) ) { 94 echo wc_price( $fees ); 95 return; 96 } 97 echo '<span class="na">–</span>'; 98 return; 87 99 } 88 100 if ( $column == 'order_stripenet' ) { 89 if ( ! $net = get_post_meta( get_the_ID(), 'Net Revenue From Stripe' )[0]) {90 echo '<span class="na">–</span>';101 if ( $net = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_META_NAME_NET, true ) ) { 102 echo wc_price( $net ); 91 103 return; 92 104 } 93 echo wc_price( $net ); 105 else if ( $net = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_NET, true ) ) { 106 echo wc_price( $net ); 107 return; 108 } 109 echo '<span class="na">–</span>'; 110 return; 94 111 } 95 112 } … … 116 133 if ( isset( $vars['orderby'] ) ) { 117 134 if ( 'order_stripefees' == $vars['orderby'] ) { 135 // $vars = array_merge( $vars, array( 136 // 'meta_key' => SHOWWOOSTRIPE_LEGACY_META_NAME_FEE, 137 // 'orderby' => 'meta_value_num', 138 // ) ); 118 139 $vars = array_merge( $vars, array( 119 'meta_key' => 'Stripe Fee', 120 'orderby' => 'meta_value_num', 140 'meta_query' => array( 141 'relation' => 'OR', 142 'stripe_old_clause' => array( 143 'key' => SHOWWOOSTRIPE_LEGACY_META_NAME_FEE, 144 'compare' => 'EXISTS', 145 ), 146 'stripe_new_clause' => array( 147 'key' => SHOWWOOSTRIPE_META_NAME_FEE, 148 'compare' => 'EXISTS', 149 ), 150 ), 151 // Hack to get the ordering in roughly the right place 152 'orderby' => 'order_total', 121 153 ) ); 122 154 } 123 155 if ( 'order_stripenet' == $vars['orderby'] ) { 156 // $vars = array_merge( $vars, array( 157 // 'meta_key' => SHOWWOOSTRIPE_LEGACY_META_NAME_NET, 158 // 'orderby' => 'meta_value_num', 159 // ) ); 124 160 $vars = array_merge( $vars, array( 125 'meta_key' => 'Net Revenue From Stripe', 126 'orderby' => 'meta_value_num', 161 'meta_query' => array( 162 'relation' => 'OR', 163 'stripe_old_clause' => array( 164 'key' => SHOWWOOSTRIPE_LEGACY_META_NAME_NET, 165 'compare' => 'EXISTS', 166 ), 167 'stripe_new_clause' => array( 168 'key' => SHOWWOOSTRIPE_META_NAME_NET, 169 'compare' => 'EXISTS', 170 ), 171 ), 172 // Hack to get the ordering in roughly the right place 173 'orderby' => 'order_total', 127 174 ) ); 128 175 } -
show-net-revenue-from-woocommerce-stripe-gateway/trunk/readme.txt
r1593398 r1967283 2 2 Contributors: boswall 3 3 Requires at least: 4.6 4 Tested up to: 4.7.2 4 Tested up to: 5.0 5 Stable tag: trunk 5 6 License: GPL-2.0+ 6 7 License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 9 10 10 11 == Description == 11 The WooCommerce Stripe Gateway adds extra information to each order about the fee taken and the remaining net revenue. However, it doesn\'t show this anywhere.12 The WooCommerce Stripe Gateway adds extra information to each order about the fee taken and the remaining net revenue. Before v4.0.0 this information is not visible anywhere. After v4.0.0 this is only visible for new orders in the Order page. 12 13 13 This plugin adds two columns to the WooCommerce Order list and below the Order totals on the Order page . Visible by shop admins only.14 This plugin adds two columns to the WooCommerce Order list and below the Order totals on the Order page (on legacy orders). Visible by shop admins only. -
show-net-revenue-from-woocommerce-stripe-gateway/trunk/show-net-revenue-from-woocommerce-stripe-gateway.php
r1593398 r1967283 2 2 /** 3 3 * Plugin Name: Show Net Revenue from WooCommerce Stripe Gateway 4 * Plugin URI: https://github.com/boswall/ show-woostripe-revenue4 * Plugin URI: https://github.com/boswall/Show-Net-Revenue-from-WooCommerce-Stripe-Gateway 5 5 * Description: Shows the Stripe fee and net revenue for Woocommerce order listings in the admin area. 6 * Version: 1. 0.06 * Version: 1.1.0 7 7 * Author: Matt Rose 8 8 * Author URI: http://glaikit.co.uk/ … … 17 17 die; 18 18 } 19 20 // Define our meta keys 21 define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_FEE', 'Stripe Fee' ); 22 define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_NET', 'Net Revenue From Stripe' ); 23 define( 'SHOWWOOSTRIPE_META_NAME_FEE', '_stripe_fee' ); 24 define( 'SHOWWOOSTRIPE_META_NAME_NET', '_stripe_net' ); 25 define( 'SHOWWOOSTRIPE_META_NAME_STRIPE_CURRENCY', '_stripe_currency' ); 19 26 20 27 // Fiters and Actions needed to make everything work. … … 38 45 */ 39 46 function show_woostripe_revenue_admin_order_totals_after_refunded( $order_id ) { 40 if ( $fees = get_post_meta( get_the_ID(), 'Stripe Fee')[0] ) {47 if ( $fees = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_FEE )[0] ) { 41 48 ?> 42 49 … … 50 57 } 51 58 52 if ( $net = get_post_meta( get_the_ID(), 'Net Revenue From Stripe')[0] ) {59 if ( $net = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_NET )[0] ) { 53 60 ?> 54 61 … … 80 87 function show_woostripe_revenue_render_shop_order_columns( $column ) { 81 88 if ( $column == 'order_stripefees' ) { 82 if ( ! $fees = get_post_meta( get_the_ID(), 'Stripe Fee' )[0]) {83 echo '<span class="na">–</span>';89 if ( $fees = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_META_NAME_FEE, true ) ) { 90 echo wc_price( $fees ); 84 91 return; 85 92 } 86 echo wc_price( $fees ); 93 else if ( $fees = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_FEE, true ) ) { 94 echo wc_price( $fees ); 95 return; 96 } 97 echo '<span class="na">–</span>'; 98 return; 87 99 } 88 100 if ( $column == 'order_stripenet' ) { 89 if ( ! $net = get_post_meta( get_the_ID(), 'Net Revenue From Stripe' )[0]) {90 echo '<span class="na">–</span>';101 if ( $net = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_META_NAME_NET, true ) ) { 102 echo wc_price( $net ); 91 103 return; 92 104 } 93 echo wc_price( $net ); 105 else if ( $net = get_post_meta( get_the_ID(), SHOWWOOSTRIPE_LEGACY_META_NAME_NET, true ) ) { 106 echo wc_price( $net ); 107 return; 108 } 109 echo '<span class="na">–</span>'; 110 return; 94 111 } 95 112 } … … 116 133 if ( isset( $vars['orderby'] ) ) { 117 134 if ( 'order_stripefees' == $vars['orderby'] ) { 135 // $vars = array_merge( $vars, array( 136 // 'meta_key' => SHOWWOOSTRIPE_LEGACY_META_NAME_FEE, 137 // 'orderby' => 'meta_value_num', 138 // ) ); 118 139 $vars = array_merge( $vars, array( 119 'meta_key' => 'Stripe Fee', 120 'orderby' => 'meta_value_num', 140 'meta_query' => array( 141 'relation' => 'OR', 142 'stripe_old_clause' => array( 143 'key' => SHOWWOOSTRIPE_LEGACY_META_NAME_FEE, 144 'compare' => 'EXISTS', 145 ), 146 'stripe_new_clause' => array( 147 'key' => SHOWWOOSTRIPE_META_NAME_FEE, 148 'compare' => 'EXISTS', 149 ), 150 ), 151 // Hack to get the ordering in roughly the right place 152 'orderby' => 'order_total', 121 153 ) ); 122 154 } 123 155 if ( 'order_stripenet' == $vars['orderby'] ) { 156 // $vars = array_merge( $vars, array( 157 // 'meta_key' => SHOWWOOSTRIPE_LEGACY_META_NAME_NET, 158 // 'orderby' => 'meta_value_num', 159 // ) ); 124 160 $vars = array_merge( $vars, array( 125 'meta_key' => 'Net Revenue From Stripe', 126 'orderby' => 'meta_value_num', 161 'meta_query' => array( 162 'relation' => 'OR', 163 'stripe_old_clause' => array( 164 'key' => SHOWWOOSTRIPE_LEGACY_META_NAME_NET, 165 'compare' => 'EXISTS', 166 ), 167 'stripe_new_clause' => array( 168 'key' => SHOWWOOSTRIPE_META_NAME_NET, 169 'compare' => 'EXISTS', 170 ), 171 ), 172 // Hack to get the ordering in roughly the right place 173 'orderby' => 'order_total', 127 174 ) ); 128 175 }
Note: See TracChangeset
for help on using the changeset viewer.