File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
modules/ppcp-api-client/src/Factory Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,29 @@ public function from_state(
3333 ?WC_Cart $ cart = null ,
3434 string $ funding_source = ''
3535 ): string {
36+ /**
37+ * If you are using this filter to set 'NO_SHIPPING', you may also want to disable sending
38+ * shipping fields completely.
39+ *
40+ * @see PurchaseUnitFactory::shipping_needed() for
41+ * the woocommerce_paypal_payments_shipping_needed filter.
42+ *
43+ * @see ExperienceContext for SHIPPING_PREFERENCE_* constants.
44+ * @see https://developer.paypal.com/serversdk/php/models/enumerations/shipping-preference/
45+ */
46+ $ shipping_preference = apply_filters (
47+ 'woocommerce_paypal_payments_shipping_preference ' ,
48+ null ,
49+ $ purchase_unit ,
50+ $ context ,
51+ $ cart ,
52+ $ funding_source
53+ );
54+
55+ if ( is_string ( $ shipping_preference ) ) {
56+ return $ shipping_preference ;
57+ }
58+
3659 $ contains_physical_goods = $ purchase_unit ->contains_physical_goods ();
3760 if ( ! $ contains_physical_goods ) {
3861 return ExperienceContext::SHIPPING_PREFERENCE_NO_SHIPPING ;
You can’t perform that action at this time.
0 commit comments