AffiliateWP – Order Details For Affiliates Shortcode

Below, you’ll find a detailed guide on how to add the AffiliateWP – Order Details For Affiliates Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the AffiliateWP – Order Details For Affiliates Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the AffiliateWP – Order Details For Affiliates Plugin and the shortcodes it provides:

Plugin Icon
AffiliateWP – Order Details For Affiliates

"AffiliateWP – Order Details For Affiliates is a WordPress plugin facilitating a seamless sharing of order details with affiliates. It enhances transparency in affiliate marketing."

✩✩✩✩✩ () Active Installs: 3000+ Tested with: 6.0.6 PHP Version: 5.6
Included Shortcodes:
  • [affiliate_order_details]

AffiliateWP – Order Details For Affiliates [affiliate_order_details] Shortcode

The AffiliateWP Order Details shortcode enables affiliates to access their order details. It checks if the user is an active affiliate and if they have the appropriate access rights. Parameters include ‘number’ for the order number, ‘affiliate_id’ for the affiliate’s ID, and ‘status’ for the order status. It returns the relevant order details.

Shortcode: [affiliate_order_details]

Parameters

Here is a list of all possible affiliate_order_details shortcode parameters and attributes:

  • number – Defines the number of order details to display.
  • affiliate_id – Specifies the affiliate id for which order details are shown.
  • status – Filters the order details based on their status.

Examples and Usage

Basic example – Utilizes the ‘affiliate_order_details’ shortcode without any parameters. This will display the order details for the current logged-in affiliate, assuming they have the necessary permissions.

[affiliate_order_details /]

Advanced examples

Example 1 – This shortcode is used with the ‘number’ parameter. It will display a specific number of order details for the logged-in affiliate.

[affiliate_order_details number=5 /]

Example 2 – This shortcode is used with the ‘affiliate_id’ parameter. It will display the order details for the affiliate with the specified ID, given that the current user has the necessary permissions to view these details.

[affiliate_order_details affiliate_id=10 /]

Example 3 – This shortcode is used with both the ‘status’ and ‘number’ parameters. It will display a specific number of order details with a particular status for the logged-in affiliate.

[affiliate_order_details status="completed" number=3 /]

Note: The ‘status’ parameter in the above example should match one of the order statuses used in your AffiliateWP setup. Common statuses include ‘completed’, ‘pending’, and ‘refunded’.

PHP Function Code

In case you have difficulties debugging what causing issues with [affiliate_order_details] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'affiliate_order_details', array( $this, 'affiliate_order_details' ) );

Shortcode PHP function:

function affiliate_order_details( $atts, $content = null ) {

		global $affwp_od_atts;

		if ( ! ( affwp_is_affiliate() && affwp_is_active_affiliate() ) ) {
			return;
		}

		if ( ! ( affiliatewp_order_details_for_affiliates()->can_access_order_details() || affiliatewp_order_details_for_affiliates()->global_order_details_access() ) ) {
			return;
		}

		$affwp_od_atts = shortcode_atts(
			array(
				'number'       => '',
				'affiliate_id' => '',
				'status'       => '',

			),
			$atts,
			'affiliate_order_details'
		);

		ob_start();

		affiliate_wp()->templates->get_template_part( 'dashboard-tab', 'order-details' );

		$content = ob_get_clean();

		return do_shortcode( $content );
	}

Code file location:

affiliatewp-order-details-for-affiliates/affiliatewp-order-details-for-affiliates/includes/class-shortcodes.php

Conclusion

Now that you’ve learned how to embed the AffiliateWP – Order Details For Affiliates Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *