Last active
October 23, 2019 11:04
-
-
Save jessepearson/3c258df272e73db875e901c0909a3554 to your computer and use it in GitHub Desktop.
Simple filter to change the 'no_shipping' value from 1 to 2 with PayPal Standard in WooCommerce when no shipping is needed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // do not copy this line | |
/** | |
* Simple filter to change the 'no_shipping' value from 1 to 2 with | |
* PayPal Standard in WooCommerce when no shipping is needed. | |
* | |
* @param arr $data The original data. | |
* @return arr The updated data. | |
* @link https://wordpress.org/support/topic/shipping-and-or-billing-address-not-being-sent-to-paypal-2/ | |
* @link https://gist.github.com/jessepearson/3c258df272e73db875e901c0909a3554 | |
*/ | |
function jp_set_paypal_no_shipping_to_two( $data ) { | |
if ( isset( $data['no_shipping'] ) && 1 == $data['no_shipping'] ) { | |
$data['no_shipping'] = 2; | |
} | |
return $data; | |
} | |
add_filter( 'woocommerce_paypal_args', 'jp_set_paypal_no_shipping_to_two', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment