woocommerce_paypal_line_item

The WooCommerce woocommerce paypal line item hook.

Description

apply_filters( 'woocommerce_paypal_line_item', (string) $item_name, (string) $item_name, (unknown) $quantity, (number) $amount, (number) $item_number ); 

Parameters (5)

0. $item_name — Optional. (callback) => array( 'item_name' => html_entity_decode( wc_trim_string( $item_name ? $item_name : __( 'Item', 'woocommerce' ), 127 ), ENT_NOQUOTES, 'UTF-8' ), 'quantity' => (int) $quantity, 'amount' => (float) $amount, 'item_number' => $item_number, )
The array.
1. $item_name (string)
The item name.
2. $quantity (unknown)
The quantity.
3. $amount (number)
The amount.
4. $item_number (number)
The item number.

Usage

To run the hook, copy the example below.
  1. $item_name = apply_filters( 'woocommerce_paypal_line_item', $item_name, $item_name, $quantity, $amount, $item_number ); 
  2.  
  3. if ( !empty( $item_name ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_paypal_line_item callback 
  2. function filter_woocommerce_paypal_line_item( $item_name, $item_name, $quantity, $amount, $item_number ) { 
  3. // make filter magic happen here... 
  4. return $item_name
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_paypal_line_item', 'filter_woocommerce_paypal_line_item', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_paypal_line_item', 'filter_woocommerce_paypal_line_item', 10, 5 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php  
  1. $item = apply_filters( 'woocommerce_paypal_line_item', array(