woocommerce / storefront

Official theme for WooCommerce
https://wordpress.org/themes/storefront/
972 stars 472 forks source link

Customizer: Items are added to cart 2 at a time when Enable AJAX add to cart is active #1477

Open jacoswan opened 4 years ago

jacoswan commented 4 years ago

Describe the bug

Items are added two at a time when Enable AJAX add to cart... is checked. Happens in Firefox, Safari, but not Chrome.

Marked as high, as low priority description doesn't fit.

Isolating the problem (mark completed items with an [x]):

To Reproduce

Steps to reproduce the behavior:

  1. Storefront is the theme.
  2. WooCommerce » Settings » Products » General, Add to cart behavior : Enable AJAX add to cart buttons on archives
  3. Appearance » Customize, view the Shop page and add a product.
  4. Notice after 1 click there are now 2 items in the cart.

Screenshots

n/a

Expected behavior

It should only add 1 item to the cart.

Browser Environment

Please provide as much detail as possible about your testing environment.

WordPress Environment

Please provide relevant details of your WordPress setup and server environment.

``` ` ### WordPress Environment ### WordPress address (URL): https://woo.tst Site address (URL): https://woo.tst WC Version: 4.5.2 REST API Version: ✔ 4.5.2 WC Blocks Version: ✔ 3.1.0 Action Scheduler Version: ✔ 3.1.6 WC Admin Version: ✔ 1.5.0 Log Directory Writable: ✔ WP Version: 5.5.1 WP Multisite: – WP Memory Limit: 999 MB WP Debug Mode: – WP Cron: ✔ Language: en_US External object cache: – ### Server Environment ### Server Info: Apache/2.4.41 (Unix) OpenSSL/1.1.1f PHP/7.4.1 PHP Version: 7.4.1 PHP Post Max Size: 64 MB PHP Time Limit: 300 PHP Max Input Vars: 4000 cURL Version: 7.67.0 OpenSSL/1.1.1f SUHOSIN Installed: – MySQL Version: 5.7.27 Max Upload Size: 64 MB Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ GZip: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Database ### WC Database Version: 4.5.2 WC Database Prefix: wp_ Total Database Size: 3.80MB Database Data Size: 2.18MB Database Index Size: 1.62MB 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.05MB + 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.02MB + Index: 0.11MB + 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.02MB + Index: 0.03MB + Engine InnoDB wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB wp_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB wp_options: Data: 1.05MB + Index: 0.06MB + Engine InnoDB wp_postmeta: Data: 0.16MB + Index: 0.16MB + Engine InnoDB wp_posts: Data: 0.06MB + Index: 0.06MB + 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_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.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_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_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB ### Post Type Counts ### attachment: 17 customize_changeset: 1 nav_menu_item: 6 page: 8 post: 2 product: 24 product_variation: 8 revision: 4 shop_coupon: 1 shop_order: 11 shop_subscription: 3 ### Security ### Secure connection (HTTPS): ✔ Hide errors from visitors: ✔ ### Active Plugins (2) ### Pay Fake for WooCommerce: by SkyVerge – 1.0.2 – Installed version not tested with active version of WooCommerce 4.5.2 WooCommerce: by Automattic – 4.5.2 ### Inactive Plugins (179) ### ... ### 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: booking (booking) 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) 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: #8 - /checkout/ My account: #9 - /my-account/ Terms and conditions: ❌ Page not set ### Theme ### Name: Storefront Version: 2.7.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: – ### Action Scheduler ### Canceled: 2 Oldest: 2020-09-21 06:08:52 +0000 Newest: 2020-09-21 06:08:52 +0000 Complete: 46 Oldest: 2020-09-19 07:51:51 +0000 Newest: 2020-09-21 13:26:23 +0000 Pending: 3 Oldest: 2020-10-21 12:47:16 +0000 Newest: 2020-11-20 12:47:16 +0000 ` ```
haszari commented 4 years ago

Hi @jacoswan - thanks for the report!

I'm having trouble reproducing this. I'm testing with Safari, and when I click add-to-cart in the Shop page, while viewing in Customizer preview, I can't reproduce the issue. Each time I click and add to cart button, I only get a single item added to the cart (as expected).

Also can you provide a bit more info about how this bug impacts stores? If it's only an issue inside the Customizer (and the front end shopper experience is working fine) then perhaps it's not urgent to fix.

jacoswan commented 4 years ago

Howdy @haszari

Peculiar. I can recreate this on all my browsers, Here's my experience in Safari : https://d.pr/i/KVhNa8

It was recorded on my Pressable site, and I can recreate it in all my browsers. Alas, it doesn't affect the front-end, so have added the low priority tag for now.

nielslange commented 4 years ago

Hello @jacoswan 👋

Thanks for the video. This is very helpful.