Plugin Directory

Changeset 1967283


Ignore:
Timestamp:
11/01/2018 04:15:54 PM (7 years ago)
Author:
Boswall
Message:

tagging v1.1

Location:
show-net-revenue-from-woocommerce-stripe-gateway
Files:
2 edited
3 copied

Legend:

Unmodified
Added
Removed
  • show-net-revenue-from-woocommerce-stripe-gateway/tags/1.1/readme.txt

    r1593398 r1967283  
    22Contributors: boswall
    33Requires at least: 4.6
    4 Tested up to: 4.7.2
     4Tested up to: 5.0
     5Stable tag: trunk
    56License: GPL-2.0+
    67License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    910
    1011== 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.
     12The 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.
    1213
    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.
     14This 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  
    22/**
    33* Plugin Name:       Show Net Revenue from WooCommerce Stripe Gateway
    4 * Plugin URI:        https://github.com/boswall/show-woostripe-revenue
     4* Plugin URI:        https://github.com/boswall/Show-Net-Revenue-from-WooCommerce-Stripe-Gateway
    55* Description:       Shows the Stripe fee and net revenue for Woocommerce order listings in the admin area.
    6 * Version:           1.0.0
     6* Version:           1.1.0
    77* Author:            Matt Rose
    88* Author URI:        http://glaikit.co.uk/
     
    1717  die;
    1818}
     19
     20// Define our meta keys
     21define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_FEE', 'Stripe Fee' );
     22define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_NET', 'Net Revenue From Stripe' );
     23define( 'SHOWWOOSTRIPE_META_NAME_FEE', '_stripe_fee' );
     24define( 'SHOWWOOSTRIPE_META_NAME_NET', '_stripe_net' );
     25define( 'SHOWWOOSTRIPE_META_NAME_STRIPE_CURRENCY', '_stripe_currency' );
    1926
    2027// Fiters and Actions needed to make everything work.
     
    3845*/
    3946function 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] ) {
    4148    ?>
    4249
     
    5057  }
    5158
    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] ) {
    5360    ?>
    5461
     
    8087function show_woostripe_revenue_render_shop_order_columns( $column ) {
    8188  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 );
    8491      return;
    8592    }
    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;
    8799  }
    88100  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 );
    91103      return;
    92104    }
    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;
    94111  }
    95112}
     
    116133    if ( isset( $vars['orderby'] ) ) {
    117134      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        // ) );
    118139        $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',
    121153        ) );
    122154      }
    123155      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        // ) );
    124160        $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',
    127174        ) );
    128175      }
  • show-net-revenue-from-woocommerce-stripe-gateway/trunk/readme.txt

    r1593398 r1967283  
    22Contributors: boswall
    33Requires at least: 4.6
    4 Tested up to: 4.7.2
     4Tested up to: 5.0
     5Stable tag: trunk
    56License: GPL-2.0+
    67License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     
    910
    1011== 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.
     12The 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.
    1213
    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.
     14This 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  
    22/**
    33* Plugin Name:       Show Net Revenue from WooCommerce Stripe Gateway
    4 * Plugin URI:        https://github.com/boswall/show-woostripe-revenue
     4* Plugin URI:        https://github.com/boswall/Show-Net-Revenue-from-WooCommerce-Stripe-Gateway
    55* Description:       Shows the Stripe fee and net revenue for Woocommerce order listings in the admin area.
    6 * Version:           1.0.0
     6* Version:           1.1.0
    77* Author:            Matt Rose
    88* Author URI:        http://glaikit.co.uk/
     
    1717  die;
    1818}
     19
     20// Define our meta keys
     21define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_FEE', 'Stripe Fee' );
     22define( 'SHOWWOOSTRIPE_LEGACY_META_NAME_NET', 'Net Revenue From Stripe' );
     23define( 'SHOWWOOSTRIPE_META_NAME_FEE', '_stripe_fee' );
     24define( 'SHOWWOOSTRIPE_META_NAME_NET', '_stripe_net' );
     25define( 'SHOWWOOSTRIPE_META_NAME_STRIPE_CURRENCY', '_stripe_currency' );
    1926
    2027// Fiters and Actions needed to make everything work.
     
    3845*/
    3946function 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] ) {
    4148    ?>
    4249
     
    5057  }
    5158
    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] ) {
    5360    ?>
    5461
     
    8087function show_woostripe_revenue_render_shop_order_columns( $column ) {
    8188  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 );
    8491      return;
    8592    }
    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;
    8799  }
    88100  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 );
    91103      return;
    92104    }
    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;
    94111  }
    95112}
     
    116133    if ( isset( $vars['orderby'] ) ) {
    117134      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        // ) );
    118139        $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',
    121153        ) );
    122154      }
    123155      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        // ) );
    124160        $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',
    127174        ) );
    128175      }
Note: See TracChangeset for help on using the changeset viewer.