buycred – buyers pay paypal fees?

[ad_1]

I want the user to pay the paypal fee when they buy points using the buycred form. I figured I could just edit the example for mycred_buycred_get_cost that is in the docs, but I copied all three examples exactly into my theme’s function.php and it breaks (no price shows up at all in the paypal popup).

Paypal fees are 3.49% + $.49 So I figured this code below would work. But again, simply no price shows up at all in the paypal confirmation popup.


/**
 * Buyer pays PayPal fees for custom point purchases

 */
add_filter( 'mycred_buycred_get_cost', 'mycredpro_buycred_user_pays_fees', 10, 3 );
function mycredpro_buycred_user_pays_fees( $cost, $type ) {

	if ( $type != 'mycred_default' ) return $cost;

	// paypal fees
	$percent_fee = 3.49;
    $set_fee = .49;

	// Get the percentage
	$percent = round( ( ( $percent_fee / 100 ) * $cost ) );

	// Deduct the discount amount
	$cost = $cost + $percent + $set_fee;

	return $cost;

}

Any help would be greatly appreciated.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer