Support » Plugin: WordPress Affiliates Plugin — SliceWP Affiliates » Remove value after Decimal

  • Resolved Dipesh

    (@dipeshpatel780)


    I want all affiliate income should be rounded off.
    Example
    14.57 it should be 15.00 like this.

Viewing 1 replies (of 1 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @dipeshpatel780,

    Thank you for reaching out! Currently, rounding off numbers can only be done through custom code and not directly from the admin interface.

    Here’s the code that does this:

    function slicewp_custom_round_up_commission_amount( $data ) {
    
    	if ( empty( $data['amount'] ) )
    		return $data;
    
    	$data['amount'] = slicewp_sanitize_amount( ceil( $data['amount'] ) );
    
    	return $data;
    
    }
    add_filter( 'slicewp_pre_insert_commission_data', 'slicewp_custom_round_up_commission_amount', 50 );

    Please copy the above code and place into your website. If you’re not sure how to add code to your site, you can use a plugin like Code Snippets (https://wordpress.org/plugins/code-snippets/).

    Please try it out and let me know how it goes.

    Thank you and best wishes,
    Mihai

Viewing 1 replies (of 1 total)
  • The topic ‘Remove value after Decimal’ is closed to new replies.