woocommerce / woocommerce-gateway-paypal-express-checkout

58 stars 65 forks source link

Paying for a manual order as a logged out guest isn't possible if "Checkout on Single Product" is disabled. #842

Closed billrobbins closed 3 years ago

billrobbins commented 3 years ago

Describe the bug

Let's say a manual order is created for a guest user. They're given the payment link and go to use PayPal Checkout to pay for the order. They're able to log into PayPal and select the funding source there. When they are returned to the site, the end up on the cart page with an empty cart instead of the order received endpoint.

To reproduce

  1. In WooCommerce > Settings > Payments > PayPal Checkout, uncheck the box to "Checkout on Single Product" and save your changes.
  2. Create a manual order for a guest.
  3. Open the payment URL in a private browser window.
  4. Pay for the order using PayPal.
  5. Notice how you're redirected to the cart page after the payment instead of the order received endpoint.
  6. Go back to WooCommerce > Settings > Payments > PayPal Checkout and check the box to enable "Checkout on Single Product" and save your changes.
  7. Try paying for this order again with PayPal in a private browser window. Notice that this time you're redirected to the Order Received endpoint.

One note, it is possible to pay for a guest order if you're logged into an account even with this setting disabled. The user has to be logged out for this to happen.

Screenshots GIF illustrating what happens after paying: https://d.pr/i/dX9oXW

Expected behavior

I expect to be able to pay for an order as a guest regardless of the "Checkout on Single Product" setting.

Environment (please complete the following information):

Additional details

3573632-zen

System status ``` ### WordPress Environment ### WordPress address (URL): https://pookiefly.com Site address (URL): https://pookiefly.com WC Version: 4.8.0 REST API Version: ✔ 4.8.0 WC Blocks Version: ✔ 4.0.0 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 1.7.3 Log Directory Writable: ✔ WP Version: 5.6 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: ✔ ### Server Environment ### Server Info: nginx PHP Version: 7.4.13 PHP Post Max Size: 2 GB PHP Time Limit: 1200 PHP Max Input Vars: 6144 cURL Version: 7.73.0 OpenSSL/1.1.1d SUHOSIN Installed: – MySQL Version: 5.5.5-10.3.23-MariaDB-log Max Upload Size: 2 GB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 4.8.0 WC Database Prefix: wp_ Total Database Size: 16.98MB Database Data Size: 10.09MB Database Index Size: 6.89MB wp_woocommerce_sessions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_order_itemmeta: Data: 0.06MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_actions: Data: 0.38MB + Index: 0.25MB + Engine InnoDB wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_actionscheduler_logs: Data: 0.16MB + Index: 0.13MB + Engine InnoDB wp_automatewoo_abandoned_carts: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_automatewoo_customers: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_log_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_cart_notices: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.06MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_custom_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_dynamic_segment_filters: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_feature_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_mapping_to_external_entities: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_newsletter_links: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_newsletter_option: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_option_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_segment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_newsletter_templates: Data: 2.52MB + Index: 0.00MB + Engine InnoDB wp_mailpoet_scheduled_tasks: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_scheduled_task_subscribers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_segments: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_sending_queues: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_settings: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_statistics_clicks: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_statistics_forms: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_statistics_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_statistics_opens: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_mailpoet_statistics_unsubscribes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_mailpoet_statistics_woocommerce_purchases: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_mailpoet_stats_notifications: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_subscribers: Data: 0.02MB + Index: 0.11MB + Engine InnoDB wp_mailpoet_subscriber_custom_field: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_subscriber_ips: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailpoet_subscriber_segment: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_mailpoet_user_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 0.42MB + Index: 0.08MB + Engine InnoDB wp_postmeta: Data: 0.34MB + Index: 0.22MB + Engine InnoDB wp_posts: Data: 0.11MB + Index: 0.06MB + Engine InnoDB wp_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_points_rewards_user_points: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_points_rewards_user_points_log: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_woocommerce_exported_csv_items: Data: 0.06MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_gc_activity: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_gc_cards: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_woocommerce_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpml_mails: Data: 0.22MB + Index: 0.00MB + Engine InnoDB wp_wps_hit: Data: 0.02MB + Index: 0.14MB + Engine InnoDB wp_wps_index: Data: 0.06MB + Index: 0.05MB + Engine InnoDB wp_wps_key: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wps_object_term: Data: 0.05MB + Index: 0.09MB + Engine InnoDB wp_wps_object_type: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_wps_query: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wps_uri: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wps_user_agent: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_actionscheduler_actions: Data: 0.28MB + Index: 0.16MB + Engine InnoDB __wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_actionscheduler_logs: Data: 0.11MB + Index: 0.11MB + Engine InnoDB __wp_automatewoo_abandoned_carts: Data: 0.02MB + Index: 0.08MB + Engine InnoDB __wp_automatewoo_customers: Data: 0.02MB + Index: 0.09MB + Engine InnoDB __wp_automatewoo_customer_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_automatewoo_events: Data: 0.02MB + Index: 0.05MB + Engine InnoDB __wp_automatewoo_guests: Data: 0.02MB + Index: 0.06MB + Engine InnoDB __wp_automatewoo_guest_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_automatewoo_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB __wp_automatewoo_log_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_automatewoo_queue: Data: 0.02MB + Index: 0.05MB + Engine InnoDB __wp_automatewoo_queue_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_comments: Data: 0.05MB + Index: 0.09MB + Engine InnoDB __wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_options: Data: 1.45MB + Index: 0.08MB + Engine InnoDB __wp_postmeta: Data: 0.34MB + Index: 0.20MB + Engine InnoDB __wp_posts: Data: 0.11MB + Index: 0.06MB + Engine InnoDB __wp_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB __wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB __wp_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB __wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_wc_points_rewards_user_points: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_wc_points_rewards_user_points_log: Data: 0.02MB + Index: 0.05MB + Engine InnoDB __wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB __wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_woocommerce_bundled_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_woocommerce_bundled_items: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB __wp_woocommerce_gc_activity: Data: 0.02MB + Index: 0.06MB + Engine InnoDB __wp_woocommerce_gc_cards: Data: 0.02MB + Index: 0.06MB + Engine InnoDB __wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_woocommerce_order_itemmeta: Data: 0.05MB + Index: 0.03MB + Engine InnoDB __wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_woocommerce_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_woocommerce_sessions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB __wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB __wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB __wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB __wp_wps_hit: Data: 0.02MB + Index: 0.14MB + Engine InnoDB __wp_wps_index: Data: 0.06MB + Index: 0.05MB + Engine InnoDB __wp_wps_key: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_wps_object_term: Data: 0.05MB + Index: 0.09MB + Engine InnoDB __wp_wps_object_type: Data: 0.02MB + Index: 0.08MB + Engine InnoDB __wp_wps_query: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_wps_uri: Data: 0.02MB + Index: 0.02MB + Engine InnoDB __wp_wps_user_agent: Data: 0.02MB + Index: 0.02MB + Engine InnoDB ### Post Type Counts ### attachment: 53 custom_css: 1 mailpoet_page: 1 nav_menu_item: 7 option-tree: 1 page: 15 post: 3 product: 30 product_variation: 24 revision: 28 shipping_package: 1 shop_coupon: 4 shop_order: 28 shop_order_refund: 4 wafs: 1 wc_membership_plan: 1 wc_user_membership: 1 wcpf_item: 2 wcpf_project: 1 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (9) ### AutomateWoo: by WooCommerce – 5.1.3 Jetpack by WordPress.com: by Automattic – 9.2.1 JSM's Show Post Metadata: by JS Morisset – 1.3.0 WooCommerce Blocks: by Automattic – 4.0.0 WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.1 WooCommerce Payments: by Automattic – 1.8.0 WooCommerce Shipping & Tax: by Automattic – 1.25.4 WooCommerce: by Automattic – 4.8.0 WP Mail Logging: by MailPoet – 1.9.7 ### Inactive Plugins (26) ### Add-on WooCommerce MailPoet 3: by Tikweb – 1.1.8 – Installed version not tested with active version of WooCommerce 4.0 Akismet Anti-Spam: by Automattic – 4.1.7 Code Snippets: by Code Snippets Pro – 2.14.0 Health Check & Troubleshooting: by The WordPress.org community – 1.4.5 MailPoet 3 (New): by MailPoet – 3.56.1 Query Monitor: by John Blackbourn – 3.6.5 Query Monitor Extend: by Caleb Stauffer – 1.0 Server IP & Memory Usage Display: by Apasionados Apasionados del Marketing – 2.1.0 User Switching: by John Blackbourn & contributors – 1.5.6 WooCommerce Advanced Shipping Packages: by Jeroen Sormani – 1.1.7 WooCommerce AvaTax: by SkyVerge – 1.11.0 WooCommerce Cart Notices: by SkyVerge – 1.13.0 WooCommerce Conditional Shipping and Payments: by SomewhereWarm – 1.8.10 WooCommerce Customer/Order/Coupon Export: by SkyVerge – 5.2.0 WooCommerce Distance Rate Shipping: by Automattic – 1.0.26 WooCommerce FedEx Shipping: by WooCommerce – 3.4.33 WooCommerce Google Analytics Integration: by WooCommerce – 1.4.25 WooCommerce Multi-currency: by TIV.NET INC – 2.8.5 WooCommerce Pre-Orders: by WooCommerce – 1.5.29 WooCommerce Shipment Tracking: by WooCommerce – 1.6.26 WooCommerce Shipping Per Product v2: by WooCommerce – 2.3.12 WooCommerce Smart Coupons: by StoreApps – 4.13.0 WooCommerce Stripe Gateway: by WooCommerce – 4.6.0 WooCommerce Table Rate Shipping: by WooCommerce – 3.0.30 WooCommerce UPS Shipping: by WooCommerce – 3.2.30 WooCommerce USPS Shipping: by WooCommerce – 4.4.49 ### Dropin Plugins (3) ### advanced-cache.php: advanced-cache.php db.php: Query Monitor Database Class object-cache.php: Memcached ### Must Use Plugins (1) ### Health Check Troubleshooting Mode: by – 1.7.1 ### Settings ### API Enabled: – Force SSL: – Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: bundle (bundle) external (external) grouped (grouped) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) Taxonomies: Product Visibility: exclude_from_catalog (exclude_from_catalog) exclude_from_search (exclude_from_search) exclude-from-catalog (exclude-from-catalog) exclude-from-search (exclude-from-search) featured (featured) outofstock (outofstock) rated-1 (rated-1) rated-2 (rated-2) rated-3 (rated-3) rated-4 (rated-4) rated-5 (rated-5) Connected to WooCommerce.com: ✔ ### WC Pages ### Shop base: #6 - /shop/ Cart: #7 - /cart/ Checkout: ❌ Page does not contain the shortcode. My account: #10 - /my-account/ Terms and conditions: ❌ Page visibility should be public ### Theme ### Name: Storefront Version: 2.9.0 (update to version 3.0.0 is available) Author URL: https://woocommerce.com/ Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme WooCommerce Support: ✔ ### Templates ### Overrides: – ### Action Scheduler ### Complete: 802 Oldest: 2020-11-15 10:22:32 -0600 Newest: 2020-12-16 10:09:00 -0600 Pending: 4 Oldest: 2020-12-16 11:09:00 -0600 Newest: 2020-12-17 08:44:22 -0600 ```
chickenn00dle commented 3 years ago

Thanks for the report @billrobbins!

Whats happening here is when attempting to pay for the order as a guest (not logged in) there is no session cookie, and so when returning from Paypal, the following check causes us to return early before processing the PP token and payer ID: https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/blob/d93e8f3e7b90c0359a1f11b074419d5fea966874/includes/class-wc-gateway-ppec-checkout-handler.php#L443-L446

And since returning early results in visiting the checkout page with an empty cart, WC redirects us to the cart page.

The reason we don't see this same behavior when Checkout on Single Product is enabled is the following callback is triggered when this setting is active: https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/blob/d93e8f3e7b90c0359a1f11b074419d5fea966874/includes/class-wc-gateway-ppec-cart-handler.php#L37

This method creates a session cookie if one isn't already set: https://github.com/woocommerce/woocommerce-gateway-paypal-express-checkout/blob/d93e8f3e7b90c0359a1f11b074419d5fea966874/includes/class-wc-gateway-ppec-cart-handler.php#L666-L678

I'm not sure if there is an issue with explicitly setting a session cookie if one doesn't exist when returning from Paypal, but I suspect that is the best way forward here. I'll do some testing and see about getting a PR submitted for this today or tomorrow.