Skip to content

PayPal Commerce: express checkout from cart/product page always fails for guests with "No available shipping options" #8252

Description

@giorgiospedaledev

nopCommerce version

4.90 (plugin Payments.PayPalCommerce v4.90.20). Reproduced on our production store running a backport of the same plugin; the affected code in 4.90.20 is identical.

Steps to reproduce

  1. Configure the PayPal Commerce plugin with buttons displayed on the shopping cart page (DisplayButtonsOnShoppingCart = true).
  2. Make sure ShippingSettings.AllowPickupInStore is disabled.
  3. As a guest (or any customer without a saved shipping address), add a shippable product to the cart.
  4. On the cart page, click the PayPal button.

Actual result: the AJAX call to PayPalCommercePublic/CreateOrder returns the error "No available shipping options" and the PayPal popup closes/never opens. Guests can never use the express buttons — which is their primary use case, since the address is supposed to be collected by PayPal.

Expected result: the PayPal order is created, the buyer picks/confirms their address in the PayPal popup (the plugin already sends shipping_preference = GET_FROM_FILE for the Cart/Product placements), and the shipping options are computed by the existing onShippingAddressChangeUpdateOrderShipping callback.

Root cause

PayPalCommerceServiceManager.PrepareShippingDetailsAsync:

  • For the Cart/Product placement it calls PrepareShippingOptionsAsync(details).
  • PrepareShippingOptionsAsync returns an empty result when details.ShippingAddress is null && !_shippingSettings.AllowPickupInStore — which is always the case for a guest, because details.ShippingAddress comes from customer.ShippingAddressId in GetCartDetailsAsync.
  • PrepareShippingDetailsAsync then throws new NopException("No available shipping options"), which aborts CreateOrder.

So the order creation requires a shipping address that, by design of the express flow (GET_FROM_FILE), doesn't exist yet.

Notes

  • Registered customers with a saved shipping address are unaffected, which is probably why this slipped through.
  • The buttons on the checkout payment-method page are unaffected (SET_PROVIDED_ADDRESS branch returns before the options are computed).
  • Stores with AllowPickupInStore enabled are partially masked from the bug because pickup points populate the options list.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions