Skip to content

Instantly share code, notes, and snippets.

@jessepearson
Last active October 23, 2019 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessepearson/3c258df272e73db875e901c0909a3554 to your computer and use it in GitHub Desktop.
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.
<?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