• When using variable pricing, throws an error in dashboard when displaying user’s downloads:

    Warning: Invalid argument supplied for foreach() in /home/oururl/public_html/wp-content/plugins/edd-sale-price/includes/class-eddsp-sale-price.php on line 93

    Fix we added seems to work, please review and merge?

    if (is_array($prices)) { //added by 1wd
    		foreach ( $prices as $key => $price ) :
    
    			if ( isset( $price['sale_price'] ) && ! empty( $price['sale_price'] ) ) :
    				$prices[ $key ]['regular_amount'] 	= $price['amount'];
    				$prices[ $key ]['amount'] 			= $price['sale_price'];
    			endif;
    
    		endforeach;
    } // added by 1wd

    https://www.ads-software.com/plugins/edd-sale-price/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi 1wdtv,

    I’m trying to recreate the issue. Which dashboard are you talking about? The Admin area, or a page on the front end of the site using the [purchase_history] shortcode?

    Daniel

    Thread Starter Spencer Forman

    (@1wdtv)

    Hi Daniel,
    In the dashboard, when using the shortcode: [download_history]

    Please note, we are also running EDD Restrict Content, EDD Software Licensing, though I cannot see any interaction there.

    It seems to me the issue (I seem to have solved on my own site) was just a use-case where I had created a grid of four items in variable pricing for this download (product), and after purchase… the shortcode was passing a string instead of an array (my guess… I didn’t debug). After adding the conditional check, it just seemed to work, without any further consequences on the front side.

    Thanks!
    spence

    Glad it’s sorted ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Warning: invalid argument supplied foreach()’ is closed to new replies.