Add shipping-related filters to avoid MISSING_%field_name% errors #3586
+40
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ticket: PCP-4220, also PCP-1546 and PCP-952.
Description
Two filters added:
woocommerce_paypal_payments_shipping_preference
andwoocommerce_paypal_payments_shipping_preference
.There was a problem with disabled shipping fields. If in any way some required shipping field is disabled, PayPal returned an error (e.g. MISSING_SHIPPING_ADDRESS or MISSING SHIPPING_CITY). This happened because
shipping_preference
was set toSET_PROVIDED_ADDRESS
, which made PayPal expect shipping fields.It was decided not to make changes in how the plugin behaves, but to add filters to let merchants deal with this problem if they manipulate checkout fields.
Example code to fix MISSING_* error:
I'm attaching the same code as a plugin.
paypal_disable_shipping.zip
Steps to Test
To merchants, who has this error we might recommend the snippet above, but not the plugin. We would need to add author and other details before providing it.
Documentation
Changelog Entry
Added filters for fixing
MISSING_%field_name%
checkout error when some shipping fields are missing.