WC_Gateway_Paypal::add_paypal_sdk_attributespublicWC 1.0

Add PayPal SDK attributes to the script.

Method of the class: WC_Gateway_Paypal{}

No Hooks.

Returns

Array.

Usage

$WC_Gateway_Paypal = new WC_Gateway_Paypal();
$WC_Gateway_Paypal->add_paypal_sdk_attributes( $attrs );
$attrs(array) (required)
Attributes.

WC_Gateway_Paypal::add_paypal_sdk_attributes() code WC 10.5.0

public function add_paypal_sdk_attributes( $attrs ) {
	if ( 'paypal-standard-sdk-js' === $attrs['id'] ) {
		$buttons   = new PayPalButtons( $this );
		$page_type = $buttons->get_page_type();

		$attrs['data-page-type']              = $page_type;
		$attrs['data-partner-attribution-id'] = 'Woo_Cart_CoreUpgrade';
	}

	return $attrs;
}