WordPress filter hook

woocommerce_paypal_args

Defined by WooCommerce and fired by 3 plugins in total, running on 7M+ sites between them.

How to use woocommerce_paypal_args

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_paypal_args', function( $merge, $order ) {
	// Change $merge here.
	return $merge;
}, 10, 2 );

Argument names come from WooCommerce's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

3 plugins that fire woocommerce_paypal_args

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_paypal_args', array_merge( $this->get_transaction_args( $order ), $this->get_line_item_args( $order, true ) ), $order ) includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php:286
  2. Multiple Payment Gateways for WooCommerce (WCMPG) icon Multiple Payment Gateways for WooCommerce (WCMPG)100+ installs apply_filters( 'woocommerce_paypal_args', array_merge ( array( 'cmd' => '_cart', 'business' => $this->email, 'currency_code' => $this->functions->get_currency($this->currency), 'charset' => 'utf-8', 'rm' => is_ssl() ? 2 : 1, 'upload' => 1, 'return' => $this->success_url, 'cancel_return' => $this->cancel_url, 'notify_url' => site_url('/?wc-api=' . get_class($this)), 'page_style' => $this->page_style, 'paymentaction' => $this->payment_ac... ) includes/paypal/class-wcmpg-paypal.php:198
  3. WP Missing Functions Plugin icon WP Missing Functions Plugin10+ installs apply_filters( 'woocommerce_paypal_args', $paypal_args ) asset/required/functions/tab4-fun.php:126

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.