PHP code example of wp-pay-extensions / easy-digital-downloads

1. Go to this page and download the library: Download wp-pay-extensions/easy-digital-downloads library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wp-pay-extensions / easy-digital-downloads example snippets




add_action( 'init', function() {
	if ( ! function_exists( 'EDD' ) ) {
		return;
	}

	EDD()->fees->add_fee( 10, 'Test Backwards Compatibility', 'test-compat' );

	EDD()->fees->add_fee( array(
		'amount' => 20,
		'label'  => 'Test',
		'id'     => 'test',
		'no_tax' => false,
		'type'   => 'item',
	) );

	EDD()->fees->add_fee( array(
		'amount' => -5.95,
		'label'  => 'Discount',
		'id'     => 'discount',
		'type'   => 'fee',
	) );

	EDD()->fees->add_fee( array(
		'amount'      => 30.75,
		'label'       => 'Arbitrary Item',
		'download_id' => 8,
		'id'          => 'arbitrary_fee',
		'type'        => 'item',
	) );
} );