File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
modules/ppcp-api-client/src/Factory Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,23 @@ function ( \stdClass $item ): Item {
289289 */
290290 private function shipping_needed ( Item ...$ items ): bool {
291291
292+ /**
293+ * If you are returning false from this filter, do not forget to also set
294+ * shipping_preference to 'NO_SHIPPING', otherwise PayPal will return an error.
295+ *
296+ * @see ShippingPreferenceFactory::from_state() for
297+ * the 'woocommerce_paypal_payments_shipping_preference' filter.
298+ */
299+ $ shipping_needed = apply_filters (
300+ 'woocommerce_paypal_payments_shipping_needed ' ,
301+ null ,
302+ $ items
303+ );
304+
305+ if ( is_bool ( $ shipping_needed ) ) {
306+ return $ shipping_needed ;
307+ }
308+
292309 foreach ( $ items as $ item ) {
293310 if ( $ item ->category () !== Item::DIGITAL_GOODS ) {
294311 return true ;
You can’t perform that action at this time.
0 commit comments