woocommerce / woocommerce

A customizable, open-source ecommerce platform built on WordPress. Build any commerce solution you can imagine.
https://woocommerce.com
9.38k stars 10.76k forks source link

Cash on Delivery with shipping method restriction now working as the default payment method #32455

Closed ryanr14 closed 9 months ago

ryanr14 commented 2 years ago

Prerequisites

Describe the bug

I've been working on an issue where you would expect Cash on Delivery to be the default payment method. This only happens when using the Enable for shipping methods restrictions.

Expected behavior

Now, in theory, a customer should get geolocated to a shipping zone that has Free Shipping as the default. Then since Free Shipping enables Cash on Delivery if I head to checkout I should see Cash on Delivery as my default.

Actual behavior

In reality, I am not seeing this. It will always default to my second payment method even though Cash on Delivery appears first and would be the default.

https://d.pr/i/kysXTS Image link: https://d.pr/i/kysXTS

As soon as I remove the Enable for shipping methods restrictions this works.

Steps to reproduce

Here is the setup for this scenario.

WordPress Environment

`

WordPress Environment

WordPress address (URL): https://woocommercecore.mystagingwebsite.com Site address (URL): https://woocommercecore.mystagingwebsite.com WC Version: 6.3.1 REST API Version: ✔ 6.3.1 WC Blocks Version: ✔ 6.9.0 Action Scheduler Version: ✔ 3.4.0 WC Admin Version: ✔ 3.2.1 Log Directory Writable: ✔ WP Version: 5.9.2 WP Multisite: – WP Memory Limit: 512 MB WP Debug Mode: ✔ WP Cron: ✔ Language: en_US External object cache: ✔

Server Environment

Server Info: nginx PHP Version: 7.4.28 PHP Post Max Size: 2 GB PHP Time Limit: 1200 PHP Max Input Vars: 6144 cURL Version: 7.82.0 OpenSSL/1.1.0l

SUHOSIN Installed: – MySQL Version: 5.5.5-10.3.34-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: 6.3.1 WC Database Prefix: wp_ Total Database Size: 62.12MB Database Data Size: 42.80MB Database Index Size: 19.32MB wp_woocommerce_sessions: 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_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.19MB + Index: 0.17MB + 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: 7.02MB + Index: 0.13MB + Engine InnoDB fakenames: Data: 2.52MB + Index: 0.00MB + Engine InnoDB vp_backup_wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB vp_backup_wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_options: Data: 0.28MB + Index: 0.05MB + Engine InnoDB vp_backup_wp_postmeta: Data: 0.09MB + Index: 0.06MB + Engine InnoDB vp_backup_wp_posts: Data: 0.06MB + Index: 0.06MB + Engine InnoDB vp_backup_wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_usermeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB vp_backup_wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.05MB + Engine InnoDB vp_backup_wp_woocommerce_log: Data: 0.17MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_woocommerce_order_itemmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_woocommerce_sessions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB vp_backup_wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB vp_backup_wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB vp_backup_wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB vp_backup_wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB vp_backup_wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_actionscheduler_actions: Data: 3.02MB + Index: 1.42MB + 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: 2.02MB + Index: 1.41MB + Engine InnoDB wp_advanced_notifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_advanced_notification_triggers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 2.09MB + Index: 0.52MB + Engine InnoDB wp_email_log: Data: 1.52MB + Index: 0.00MB + Engine InnoDB wp_failed_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_followup_coupons: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_coupon_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_customers: Data: 0.02MB + Index: 0.06MB + Engine InnoDB wp_followup_customer_carts: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_customer_notes: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_customer_orders: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_followup_email_excludes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_email_logs: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_email_orders: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_followup_email_tracking: Data: 0.02MB + Index: 0.08MB + Engine InnoDB wp_followup_followup_history: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_order_categories: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_order_items: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_followup_subscribers: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_subscribers_to_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_followup_subscriber_lists: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_gla_budget_recommendations: Data: 0.22MB + Index: 0.14MB + Engine InnoDB wp_gla_merchant_issues: Data: 0.09MB + Index: 0.00MB + Engine InnoDB wp_gla_shipping_rates: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_mailchimp_carts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_mailchimp_jobs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_ms_snippets: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_options: Data: 5.20MB + Index: 1.06MB + Engine InnoDB wp_postmeta: Data: 8.52MB + Index: 8.78MB + Engine InnoDB wp_posts: Data: 2.20MB + Index: 0.50MB + Engine InnoDB wp_queue: Data: 0.02MB + Index: 0.00MB + 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: 1.52MB + Index: 1.92MB + Engine InnoDB wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wcpv_commissions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wcpv_per_product_shipping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB wp_wc_bookings_availability: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_bookings_availabilitymeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_booking_relationships: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_customer_lookup: Data: 0.13MB + Index: 0.11MB + Engine InnoDB wp_wc_deposits_payment_plans: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wc_deposits_payment_plans_schedule: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_gpf_render_cache: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_order_product_lookup: Data: 0.09MB + Index: 0.06MB + Engine InnoDB wp_wc_order_stats: Data: 0.28MB + Index: 0.25MB + 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_attributes_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + 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_warranty_products: Data: 0.02MB + Index: 0.05MB + Engine InnoDB wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_exported_csv_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_woocommerce_gpf_google_taxonomy: Data: 2.02MB + Index: 0.00MB + Engine InnoDB wp_woocommerce_square_customers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB wp_wpml_mails: Data: 1.52MB + Index: 0.00MB + Engine InnoDB

Post Type Counts

attachment: 49 follow_up_email: 2 global_product_addon: 1 jetpack_migration: 2 nav_menu_item: 5 page: 16 polylang_mo: 1 post: 1 product: 26 product_variation: 23 revision: 66 shop_coupon: 3 shop_order: 2091 shop_order_refund: 24 shop_subscription: 1 wc_membership_plan: 1 wc_order_status: 8 wc_user_membership: 1 wc_zapier_feed: 1 wcpf_item: 4 wcpf_project: 1

Security

Secure connection (HTTPS): ✔ Hide errors from visitors: ✔

Active Plugins (13)

Code Snippets: by Code Snippets Pro – 2.14.3 Facebook for WooCommerce: by Facebook – 2.6.12 Google Listings and Ads: by WooCommerce – 1.12.0 Jetpack: by Automattic – 10.8-beta2 Loco Translate: by Tim Whitlock – 2.6.1 User Switching: by John Blackbourn & contributors – 1.5.8 WooCommerce Checkout Field Editor: by WooCommerce – 1.7.0 WooCommerce Stripe Gateway: by WooCommerce – 6.3.0 WooCommerce Payments: by Automattic – 3.9.1 WooCommerce PayPal Payments: by WooCommerce – 1.7.0 WooCommerce Shipping & Tax: by WooCommerce – 1.25.25 WooCommerce Square: by WooCommerce – 2.9.1 WooCommerce: by Automattic – 6.3.1

Dropin Plugins (2)

advanced-cache.php: advanced-cache.php object-cache.php: Memcached

Settings

API Enabled: – Force SSL: ✔ Currency: USD ($) Currency Position: left Thousand Separator: , Decimal Separator: . Number of Decimals: 2 Taxonomies: Product Types: booking (booking) external (external) grouped (grouped) photography (photography) simple (simple) subscription (subscription) variable (variable) variable subscription (variable-subscription) variation (variation)

Taxonomies: Product Visibility: 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: #3 - /shop/ Cart: #4 - /cart/ Checkout: #5 - /checkout/ My account: #6 - /my-account/ Terms and conditions: #185 - /terms-conditions/

Theme

Name: Storefront Version: 4.0.0 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: –

Subscriptions

WCS_DEBUG: ✔ No Subscriptions Mode: ✔ Live Subscriptions Live URL: https://woocommercecore.mystagingwebsite.com Subscription Statuses: wc-cancelled: 1 WooCommerce Account Connected: ✔ Yes Active Product Key: ❌ No

Store Setup

Country / State: United States (US) — California

Subscriptions by Payment Gateway

WooCommerce Payments: wc-cancelled: 1

Payment Gateway Support

Cash on delivery: products WooCommerce Payments: products refunds multiple_subscriptions subscription_cancellation subscription_payment_method_change_admin subscription_payment_method_change_customer subscription_payment_method_change subscription_reactivation subscription_suspension subscriptions gateway_scheduled_payments tokenization add_payment_method

Stripe: products refunds tokenization add_payment_method

Direct bank transfer: products PayPal: refunds

WooCommerce PayPal Payments

Onboarded: ✔ Shop country code: US WooCommerce currency supported: ✔ PayPal card processing available in country: ✔ Pay Later messaging available in country: ✔ Webhook status: – Vault enabled: ✔ Logging enabled: ✔ Reference Transactions: ✔ Used PayPal Checkout plugin: ✔

WooCommerce Payments

Version: 3.9.1 Connected to WPCOM: Yes Blog ID: 118514079 Account ID: acct_1GGSVZAh7peJIj2a

Action Scheduler

Complete: 4,034 Oldest: 2022-03-01 17:25:30 -0500 Newest: 2022-04-01 11:35:36 -0400

Failed: 1 Oldest: 2020-02-05 13:38:16 -0500 Newest: 2020-02-05 13:38:16 -0500

Pending: 8 Oldest: 2022-04-01 12:12:52 -0400 Newest: 2022-04-05 17:08:03 -0400

Status report information

Generated at: 2022-04-01 11:46:12 -04:00 `

Isolating the problem

woocommercebot commented 2 years ago

We are adding the status: needs reproduction label to this issue to try reproduce it on the current released version of WooCommerce.

Thank you for your patience.

swatipawarGS commented 2 years ago

Hi @ryanr14,

Thank you for taking the time to report this bug, we really appreciate your help. We are unable to reproduce the issue on our end using WooCommerce 6.3.1 version and WordPress 5.9.2 version.

Please find below screenshot for reference :

#32455

Please provide us more detailed and any additional steps required to repro this issue which may help us to evaluate it further.


ralucaStan commented 9 months ago

Closing this issue as there is nothing actionable on our end