• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_update_old_payments_with_totals() – Updates all old payments, prior to 1.2, with new meta for the total purchase amount

You appear to be a bot. Output may be restricted

Description

Updates all old payments, prior to 1.2, with new meta for the total purchase amount

This is so that payments can be queried by their totals

Usage

$void = edd_update_old_payments_with_totals( $data );

Parameters

$data
( array ) required – Arguments passed

Returns

void

Source

File name: easy-digital-downloads/includes/payments/actions.php


Lines:

1 to 29 of 29
function edd_update_old_payments_with_totals( $data ) {
  if ( ! wp_verify_nonce( $data['_wpnonce'], 'edd_upgrade_payments_nonce' ) ) {
    return;
  }

  if ( get_option( 'edd_payment_totals_upgraded' ) ) {
    return;
  }

  $payments = edd_get_payments( array(
    'offset' => 0,
    'number' => -1,
    'mode'   => 'all',
  ) );

  if ( $payments ) {
    foreach ( $payments as $payment ) {

      $payment = new EDD_Payment( $payment->ID );
      $meta    = $payment->get_meta();

      $payment->total = $meta['amount'];
      $payment->save();
    }
  }

  add_option( 'edd_payment_totals_upgraded', 1 );
}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 8th April 2020

Primary Sidebar

Information

Function name: edd_update_old_payments_with_totals
Plugin ref: Easy Digital Downloads
Version: 2.9.26
Sourcefile: includes/payments/actions.php
File ref: includes/payments/actions.php
Deprecated?: No
API Letters: E,O,P,U,W

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.6.2
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites