woocommerce_paypal_line_item
Add PayPal Line Item.
Использование
add_filter( 'woocommerce_paypal_line_item', 'wp_kama_woocommerce_paypal_line_item_filter', 10, 4 ); /** * Function for `woocommerce_paypal_line_item` filter-hook. * * @param string $item_name Item name. * @param int $quantity Item quantity. * @param float $amount Amount. * @param $item_number * * @return string */ function wp_kama_woocommerce_paypal_line_item_filter( $item_name, $quantity, $amount, $item_number ){ // filter... return $item_name; }
- $item_name(строка)
- Item name.
- $quantity(int)
- Item quantity.
- $amount(float)
- Amount.
- $item_number
- -
Где вызывается хук
woocommerce_paypal_line_item
woocommerce/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php 492-504
$item = apply_filters( 'woocommerce_paypal_line_item', array( 'item_name' => html_entity_decode( wc_trim_string( $item_name ? wp_strip_all_tags( $item_name ) : __( 'Item', 'woocommerce' ), 127 ), ENT_NOQUOTES, 'UTF-8' ), 'quantity' => (int) $quantity, 'amount' => wc_float_to_string( (float) $amount ), 'item_number' => $item_number, ), $item_name, $quantity, $amount, $item_number );