• Resolved Deea

    (@whereisdeea)


    Hey,

    Is it possible to add extra replaceable tags in emails? We’d like to add the commission’s ID in both administrator and affiliate email notifications. From what I see, this tag isn’t available in the plugin.

    Thank you!

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

    (@iovamihai)

    Hey @whereisdeea,

    Currently, this can only be done using code. I recommend adding the following code into your website using a code snippets plugin:

    /**
     * Registers the "commission_id" merge tag for email notifications.
     *
     * @param array $tags
     *
     * @return array
     *
     */
    function slicewp_custom_register_merge_tags_commission_id( $tags ) {
    	
    	$tags['commission_id'] = array(
    		'description' => "Replaces the tag with the commission ID",
    		'callback'	  => 'slicewp_custom_merge_tag_commission_id_callback'
    	);
    	
    	return $tags;
    
    }
    add_filter( 'slicewp_register_merge_tags', 'slicewp_custom_register_merge_tags_commission_id' );
    
    /**
     * The callback for the "commission_id" merge tag.
     *
     * @param array $data
     *
     * @return string
     *
     */
    function slicewp_custom_merge_tag_commission_id_callback( $data ) {
    	
    	if ( empty( $data['commission'] ) )
    		return '';
    
    	return $data['commission']->get( 'id' );
    	
    }

    With the code added, you can add the {{commission_id}} tag to your email notification content and title, which will get replaced with the actual commission ID when the email is sent.

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

    Best wishes,
    Mihai

Viewing 1 replies (of 1 total)
  • The topic ‘Extra replaceable tags?’ is closed to new replies.