New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
order-attribution.min.js is throwing an error causing the rest of my JS to break #44159
Comments
Hi @JakobJR, Thanks for the report. I see that you're using a theme other than the default WordPress theme or Storefront. Can you confirm that you still see this issue with a default theme and/or storefront? |
I can confirm there is no error when using a default theme, but I have never had any problems developing custom themes using WooCommerce. What should be the solution for me in this instance? |
So I found out in my case, that not rendering the shipping fields (by removing Maybe we can check if they exist to avoid that error? |
Order attribution fields are shown indeed via It'd be great if there was a
|
Thank you @JakobJR for reporting and investigating! I already have a fix in mind, as I was planning to clean up a code a bit to make it bulletproof for bugs similar to this one. From what you've reported:
So the quick fix would be just to add However, I do see few more things to improve:
I'll create two PRs,
|
hm... wait
We use So, if you see this error, it means you have some @JakobJR
|
in case the checkout form does not contain `woocommerce_checkout_shipping`, `woocommerce_after_order_notes`. Addresses part of #44159
to move DOM manipulations to JS only. To support multiple checkout & register forms on the same page. Addresses #44159
to move DOM manipulations to JS only. To support multiple checkout & register forms on the same page. Addresses #44159
to move DOM manipulations to JS only. To support multiple checkout & register forms on the same page. Addresses #44159
I wasn't able to reproduce your scenario, so I'd appreciate your feedback so I can identify all the problems involved. I published two PRs, still as a draft. I'd like to make sure they really fix your case, do a bit more testing, and polish them out. But feel free to try them out.
|
In case that attribution fields are not being rendered on checkout (for example action removed)
PR #44333 easily fixes the initial problem, which is great. Also adds possibility for custom checkout flows to output the input fields where necessary. PR #44335 is indeed a bigger take. However, this one seems to eliminate issue where there could be registration form somewhere in checkout aswell (some slide-in form or what ever) and then renders all the values where is outputted, eliminates issue where values are not being filled because of multiple forms/inputs. I quickly copied some code parts from your PRs to test out, but ran into issue where wc_order_attribution.fields was an array with numerated keys, so in JS Maybe |
Thank you for the quick answer. However, I'm afraid there still may be something else contributing to the problem on you env:
Suggests to me that something odd is happening. Wherever the Could you open the page's source and search for "attribution"? <script src="https://my-site.test/wp-content/plugins/woocommerce/assets/js/sourcebuster/sourcebuster.min.js?ver=8.7.0" id="sourcebuster-js-js"></script>
<script id="wc-order-attribution-js-extra">
var wc_order_attribution = {"params":{"lifetime":1.0e-5,"session":30,"ajaxurl":"https:\/\/my-site.test\/wp-admin\/admin-ajax.php","prefix":"wc_order_attribution_","allowTracking":true},"fields":{"source_type":"current.typ","referrer":"current_add.rf","utm_campaign":"current.cmp","utm_source":"current.src","utm_medium":"current.mdm","utm_content":"current.cnt","utm_id":"current.id","utm_term":"current.trm","session_entry":"current_add.ep","session_start_time":"current_add.fd","session_pages":"session.pgs","session_count":"udata.vst","user_agent":"udata.uag"}};
</script>
<script src="https://my-site.test/wp-content/plugins/woocommerce/assets/js/frontend/order-attribution.min.js?ver=8.7.0" id="wc-order-attribution-js"></script> |
Do you mean to rename the element's name to plural with "s" at the end? |
Okay so the issue actually is that I am using latest release (8.5.2) and you're working with trunk version :) In latest release, "fields" were not set with Looks good! |
Ah! Thanks for checking! So it was #41690 that was improving the crashing error :) |
- Expose public method to render OA input fields - Render OA inputs on `woocommerce_checkout_after_customer_details` in case the checkout form does not contain `woocommerce_checkout_shipping`, `woocommerce_after_order_notes`. Addresses part of #44159 Co-authored-by: Justin Palmer <228780+layoutd@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com>
- Expose public method to render OA input fields - Render OA inputs on `woocommerce_checkout_after_customer_details` in case the checkout form does not contain `woocommerce_checkout_shipping`, `woocommerce_after_order_notes`. Addresses part of #44159 Co-authored-by: Justin Palmer <228780+layoutd@users.noreply.github.com> Co-authored-by: github-actions <github-actions@github.com>
Prerequisites
Describe the bug
The file order-attribution.min.js throws an error.
Expected behavior
There should be no error.
Actual behavior
The file order-attribution.min.js throws an error causing the rest of my JS to be blocked.
I have not changed my checkout flow or code in more than a year.
Steps to reproduce
I'm not sure, but here is the error:
WordPress Environment
`
WordPress Environment
WordPress address (URL): https://mohdestudio.dk
Site address (URL): https://mohdestudio.dk
WC Version: 8.5.2
REST API Version: ✔ 8.5.2
WC Blocks Version: ✔ 11.8.0-dev
Action Scheduler Version: ✔ 3.7.1
Log Directory Writable: ✔
WP Version: 6.4.2
WP Multisite: –
WP Memory Limit: 2 GB
WP Debug Mode: –
WP Cron: ✔
Language: da_DK
External object cache: –
Server Environment
Server Info: Apache
PHP Version: 7.4.33
PHP Post Max Size: 1 GB
PHP Time Limit: 300
PHP Max Input Vars: 5000
cURL Version: 7.29.0
NSS/3.90
SUHOSIN Installed: –
MySQL Version: 8.0.35-27
Max Upload Size: 1 GB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔
Database
WC Database Version: 8.5.2
WC Database Prefix: wp_
Total databasestørrelse: 40.48MB
Database datastørrelse: 31.36MB
Database indexstørrelse: 9.12MB
wp_woocommerce_sessions: Data: 1.02MB + Index: 0.05MB + 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.22MB + Index: 0.22MB + 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.17MB + Index: 0.14MB + Engine InnoDB
wp_aws_cache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_aws_index: Data: 2.52MB + Index: 2.03MB + Engine InnoDB
wp_berocket_termmeta: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_cli_cookie_scan: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cli_cookie_scan_categories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_cli_cookie_scan_cookies: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_cli_cookie_scan_url: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cli_scripts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_comments: Data: 0.16MB + Index: 0.09MB + Engine InnoDB
wp_duplicator_packages: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_jetpack_sync_queue: Data: 0.02MB + Index: 0.06MB + 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_options: Data: 5.19MB + Index: 0.30MB + Engine InnoDB
wp_postmeta: Data: 7.52MB + Index: 4.03MB + Engine InnoDB
wp_posts: Data: 0.17MB + Index: 0.06MB + 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_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 0.03MB + Index: 0.03MB + Engine InnoDB
wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + 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_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_operational_data: 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_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
wp_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_product_attributes_lookup: Data: 0.06MB + Index: 0.05MB + Engine InnoDB
wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + 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_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wcpdf_invoice_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wdr_order_discounts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wdr_order_item_discounts: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wdr_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfblockediplog: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfblocks7: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wfconfig: Data: 0.48MB + Index: 0.00MB + Engine InnoDB
wp_wfcrawlers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wffilechanges: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wffilemods: Data: 3.52MB + Index: 0.00MB + Engine InnoDB
wp_wfhits: Data: 0.06MB + Index: 0.05MB + Engine InnoDB
wp_wfhoover: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wfissues: Data: 0.05MB + Index: 0.06MB + Engine InnoDB
wp_wfknownfilelist: Data: 3.52MB + Index: 0.00MB + Engine InnoDB
wp_wflivetraffichuman: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wflocs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wflogins: Data: 0.08MB + Index: 0.03MB + Engine InnoDB
wp_wfls_2fa_secrets: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wfls_role_counts: Data: 0.00MB + Index: 0.00MB + Engine MEMORY
wp_wfls_settings: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfnotifications: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfpendingissues: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_wfreversecache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfsecurityevents: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfsnipcache: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wfstatus: Data: 0.14MB + Index: 0.09MB + Engine InnoDB
wp_wftrafficrates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wfwaffailures: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpml_mails: Data: 4.52MB + Index: 0.00MB + Engine InnoDB
wp_yoast_indexable: Data: 0.23MB + Index: 0.09MB + Engine InnoDB
wp_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_yoast_seo_links: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
Post Type Counts
acf-field: 30
acf-field-group: 6
attachment: 1183
br_filters_group: 1
br_product_filter: 2
cookielawinfo: 6
nav_menu_item: 64
page: 8
post: 1
product: 269
product_variation: 1089
revision: 245
shop_coupon: 11
shop_order: 115
shop_order_refund: 6
wp_global_styles: 2
Security
Secure connection (HTTPS): ✔
Hide errors from visitors: ✔
Active Plugins (21)
Advanced Custom Fields PRO: af Delicious Brains – 5.12.2
Advanced Woo Search: af ILLID – 2.98
CookieYes | GDPR Cookie Consent: af CookieYes – 3.1.8
Duplicator: af Duplicator – 1.5.8
Facebook til WooCommerce: af Facebook – 3.1.9
Google Analytics for WordPress by MonsterInsights: af MonsterInsights – 8.23.1
Jetpack: af Automattic – 13.0
Mailchimp for WooCommerce: af Mailchimp – 3.6
Max Mega Menu: af megamenu.com – 3.3
Shipmondo til WooCommerce: af Shipmondo – 4.2.0
Regenerere miniaturebilleder: af Alex Mills (Viper007Bond) – 3.1.6
Variation Swatches for WooCommerce: af AovUp – 2.2.1
Preview E-mails for WooCommerce: af Digamber Pradhan – 2.2.1
Advanced AJAX Product Filters for WooCommerce: af BeRocket – 1.6.4.6
PDF Invoices & Packing Slips for WooCommerce: af WP Overnight – 3.7.7
WooCommerce QuickPay: af Perfect Solution – 7.0.4
WooCommerce: af Automattic – 8.5.2
Wordfence Security: af Wordfence – 7.11.1
Yoast SEO: af Team Yoast – 21.9.1
WP Mail Logging: af WP Mail Logging Team – 1.12.0
WP Mail SMTP: af WP Mail SMTP – 3.11.1
Inactive Plugins (0)
Settings
API Enabled: ✔
Force SSL: –
Currency: DKK (kr.)
Currency Position: right_space
Thousand Separator: .
Decimal Separator: ,
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
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 Woo.com: –
Enforce Approved Product Download Directories: –
HPOS feature screen enabled: –
HPOS feature enabled: –
Order datastore: WC_Order_Data_Store_CPT
HPOS data sync enabled: –
WC Pages
Shop basisside: #6 - /shop/
Kurv: #7 - /kurv/
Checkout: #8 - /kasse/
Min konto: #9 - /min-konto/
Vilkår og betingelser: #260 - /handelsbetingelser/
Theme
Name: mohdestudio
Version: 1.0.0
Author URL: http://underscores.me/
Child Theme: ❌ – Hvis du redigerer WooCommerce i et hovedtema
som du ikke selv har udviklet
anbefaler vi
at du anvender et undertema (child theme). Se: Hvordan du opretter et undertema
WooCommerce Support: ✔
Templates
Overrides: mohdestudio/woocommerce/archive-product.php
mohdestudio/woocommerce/checkout/form-checkout.php
mohdestudio/woocommerce/checkout/form-coupon.php version 3.4.4 er udgået. Kerneversionen er 7.0.1
mohdestudio/woocommerce/checkout/thankyou.php version 3.7.0 er udgået. Kerneversionen er 8.1.0
mohdestudio/woocommerce/content-single-product.php
mohdestudio/woocommerce/loop/pagination.php
mohdestudio/woocommerce/single-product/product-image.php version 3.5.1 er udgået. Kerneversionen er 7.8.0
Outdated Templates: ❌
Admin
Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
product-variation-management
product-virtual-downloadable
product-external-affiliate
product-grouped
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page
Disabled Features: customize-store
minified-js
new-product-management-experience
product-linked
settings
async-product-editor-category-field
Daily Cron: ✔ Next scheduled: 2024-01-30 19:07:26 +01:00
Options: ✔
Notes: 173
Onboarding: completed
Action Scheduler
Gennemført: 1.125
Oldest: 2023-12-29 20:46:08 +0100
Newest: 2024-01-29 19:59:41 +0100
Mislykket: 18
Oldest: 2022-11-06 18:19:49 +0100
Newest: 2023-06-01 09:09:43 +0200
Igangværende: 4
Oldest: 2024-01-30 01:49:41 +0100
Newest: 2024-02-05 13:54:43 +0100
Status report information
Generated at: 2024-01-29 20:15:12 +01:00
`
Isolating the problem
The text was updated successfully, but these errors were encountered: