• Resolved flowra92

    (@flowra92)


    Hi,

    I have a Woocommerce-based webshop, edited with Elementor, where the checkout page sends the order without filling in and ticking the required fields.
    How can I make it so that it can only send the order after the required fields have been filled in and ticked correctly?

    Thank You!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi there,

    Thanks for reaching out!

    If I understand correctly, customers are able to checkout without filling in the required fields, is this correct?

    If so, this is unusual behavior, as, by default, the required fields need to have information added before checkout can be completed.

    I’d like to take a closer look at your site’s current environment, please can you share a copy of your site’s System Status Report which you can find via WooCommerce → Status.

    Select Get system report and then Download for Support. This will download a TXT file that has the contents of the SSR which you can then share with us here.

    Cheers!

    Thread Starter flowra92

    (@flowra92)

    Hi! Thank you very much for your help, I will send you the system report:

    WordPress Environment
    
    WordPress address (URL): https://magyargeprongy.hu
    Site address (URL): https://magyargeprongy.hu
    WC Version: 8.2.1
    REST API Version: ✔ 8.2.1
    WC Blocks Version: ✔ 11.1.2
    Action Scheduler Version: ✔ 3.6.3
    Log Directory Writable: ✔
    WP Version: 6.3.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: hu_HU
    External object cache: – Server Environment
    
    Server Info: Apache
    PHP Version: 8.2.11
    PHP Post Max Size: 8 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    cURL Version: 7.81.0
    OpenSSL/3.0.2
    
    SUHOSIN Installed: –
    MySQL Version: 10.6.12-MariaDB-0ubuntu0.22.04.1
    Max Upload Size: 2 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔ Database
    
    WC Database Version: 8.2.1
    WC Database Prefix: K7mJzi1T_
    Teljes adatbázis mérete: 56.30MB
    Adatbázis adatok mérete: 49.54MB
    Adatbázis index mérete: 6.76MB
    K7mJzi1T_woocommerce_sessions: Data: 0.08MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    K7mJzi1T_woocommerce_order_items: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_woocommerce_order_itemmeta: Data: 0.11MB + Index: 0.11MB + Engine InnoDB
    K7mJzi1T_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    K7mJzi1T_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_actionscheduler_actions: Data: 0.42MB + Index: 0.41MB + Engine InnoDB
    K7mJzi1T_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_actionscheduler_logs: Data: 0.19MB + Index: 0.17MB + Engine InnoDB
    K7mJzi1T_billingo_documents: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_billingo_partnerhash: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_ac_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_connection_reports: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_no_cookie_data: Data: 1.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_sessions: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_sfw: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_cleantalk_sfw_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_sfw_personal: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_cleantalk_spamscan_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_cleantalk_ua_bl: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_cleantalk_wc_spam_orders: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_commentmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_comments: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    K7mJzi1T_e_events: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_e_submissions: Data: 0.02MB + Index: 0.27MB + Engine InnoDB
    K7mJzi1T_e_submissions_actions_log: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    K7mJzi1T_e_submissions_values: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_gla_attribute_mapping_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_gla_budget_recommendations: Data: 0.22MB + Index: 0.14MB + Engine InnoDB
    K7mJzi1T_gla_merchant_issues: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_gla_shipping_rates: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_gla_shipping_times: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_automations: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_mailpoet_automation_runs: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_automation_run_logs: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_automation_run_subjects: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_automation_triggers: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_mailpoet_automation_versions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_custom_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_dynamic_segment_filters: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_feature_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_forms: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_mailpoet_log: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_mailpoet_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletter_links: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletter_option: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletter_option_fields: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletter_posts: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletter_segment: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_newsletter_templates: Data: 2.52MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_mailpoet_scheduled_tasks: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_scheduled_task_subscribers: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_segments: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_sending_queues: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_settings: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_bounces: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_clicks: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_forms: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_newsletters: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_opens: Data: 0.02MB + Index: 0.08MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_unsubscribes: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_mailpoet_statistics_woocommerce_purchases: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    K7mJzi1T_mailpoet_stats_notifications: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_subscribers: Data: 0.02MB + Index: 0.13MB + Engine InnoDB
    K7mJzi1T_mailpoet_subscriber_custom_field: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_subscriber_ips: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_subscriber_segment: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_subscriber_tag: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_mailpoet_tags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_user_agents: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_mailpoet_user_flags: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_options: Data: 4.45MB + Index: 0.14MB + Engine InnoDB
    K7mJzi1T_postmeta: Data: 23.34MB + Index: 1.86MB + Engine InnoDB
    K7mJzi1T_posts: Data: 14.33MB + Index: 0.25MB + Engine InnoDB
    K7mJzi1T_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_usermeta: Data: 0.16MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_wc_admin_notes: Data: 0.08MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wc_admin_note_actions: Data: 0.06MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wc_customer_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wc_orders: Data: 0.02MB + Index: 0.11MB + Engine InnoDB
    K7mJzi1T_wc_orders_meta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wc_order_addresses: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    K7mJzi1T_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wc_order_operational_data: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wc_order_product_lookup: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    K7mJzi1T_wc_order_stats: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    K7mJzi1T_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wdp_orders: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_wdp_order_items: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    K7mJzi1T_wdp_persistent_rules_cache: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wdp_rules: Data: 0.11MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wpforms_payments: Data: 0.02MB + Index: 0.14MB + Engine InnoDB
    K7mJzi1T_wpforms_payment_meta: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_wpforms_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wpf_filters: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wpf_meta_keys: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wpf_meta_values: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_wpf_meta_values_bk: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    K7mJzi1T_wps_woocommerce_simplepay_payment_gateway_ipn: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_yoast_indexable: Data: 0.06MB + Index: 0.09MB + Engine InnoDB
    K7mJzi1T_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    K7mJzi1T_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    K7mJzi1T_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    K7mJzi1T_yoast_seo_links: Data: 0.08MB + Index: 0.03MB + Engine InnoDB Post Type Counts
    
    attachment: 120
    awdp_pt_rules: 1
    custom_css: 1
    customize_changeset: 4
    elementor_library: 15
    mailpoet_page: 1
    nav_menu_item: 35
    page: 18
    popup: 4
    popup_theme: 8
    post: 2
    product: 31
    revision: 932
    shop_order: 50
    wp_global_styles: 1 Security
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔ Active Plugins (22)
    
    Advanced Dynamic Pricing for WooCommerce (Pro): írta AlgolPlus – 4.4.2
    Anti-Spam by CleanTalk: írta СleanTalk - Anti-Spam Protection – 6.20
    Cookie Notice & Compliance for GDPR / CCPA: írta Hu-manity.co – 2.4.11.1
    Elementor Pro: írta Elementor.com – 3.16.2
    Elementor: írta Elementor.com – 3.16.6
    Flexible Shipping: írta Octolize – 4.22.1
    Google Listings and Ads: írta WooCommerce – 2.5.10
    Hotjar: írta Hotjar – 1.0.15
    Jetpack: írta Automattic – 12.7.1
    Pinterest for WooCommerce: írta WooCommerce – 1.3.12
    Popup Maker: írta Popup Maker – 1.18.2
    HuCommerce | Magyar WooCommerce kiegészítések: írta HuCommerce.hu – 2023.1.0
    TikTok: írta TikTok – 1.2.1
    Unit Price for WooCommerce: írta Condless – 1.1.8
    UpdraftPlus - Backup/Restore: írta UpdraftPlus.Com
    DavidAnderson – 1.23.10
    
    VAT Validator: írta Flowart – 1.0
    WooCommerce: írta Automattic – 8.2.1
    ShopLentor – WooCommerce Builder for Elementor & Gutenberg: írta HasThemes – 2.7.1
    Yoast SEO: írta Yoast csapata – 21.4
    WP Mail SMTP: írta WP Mail SMTP – 3.9.0
    WPForms Lite: írta WPForms – 1.8.4
    WooCommerce SimplePay Payment Gateway: írta WPS.hu – 2.02.32 Inactive Plugins (4)
    
    Advanced Dynamic Pricing for WooCommerce: írta AlgolPlus – 4.5.2
    Advanced Google reCAPTCHA: írta WebFactory Ltd – 1.0.15
    Akismet Anti-spam: Spam Protection: írta Automattic - Anti-spam Team – 5.3
    CheckoutWC Lite: írta CheckoutWC – 1.1.4 Dropin Plugins (1)
    
    maintenance.php: maintenance.php Must Use Plugins (1)
    
    Elementor Safe Mode: írta Elementor.com – 1.0.0 Settings
    
    API Enabled: –
    Force SSL: –
    Currency: HUF (Ft)
    Currency Position: right_space
    Thousand Separator:
    Decimal Separator: ,
    Number of Decimals: 0
    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 WooCommerce.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
    
    Webshop főoldal: #14 - /uzlet/
    Kosár: ❌ Page does not contain the [woocommerce_cart] shortcode or the woocommerce/cart block.
    Pénztár: ❌ Page does not contain the [woocommerce_checkout] shortcode or the woocommerce/checkout block.
    Fiókom: #17 - /fiokom/
    Általános Szerződési Feltételek: #1365 - /aszf/ Theme
    
    Name: Hello Elementor
    Version: 2.8.1
    Author URL: https://elementor.com/?utm_source=wp-themes&utm_campaign=author-uri&utm_medium=wp-dash
    Child Theme: ❌ – Amennyiben a WooCommerce-t egy olyan szülősablonban módosítunk
    amelyet nem saját magunk készítettünk
    akkor javasoljuk a származtatott sablon használatát. Hogyan készítsünk származtatott sablonokat
    
    WooCommerce Support: ✔ Templates
    
    Overrides: – 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
    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
    settings
    async-product-editor-category-field
    
    Daily Cron: ✔ Next scheduled: 2023-10-25 08:02:43 +00:00
    Options: ✔
    Notes: 123
    Onboarding: completed Action Scheduler
    
    Teljesítve: 890
    Oldest: 2023-09-23 11:14:39 +0000
    Newest: 2023-10-24 10:23:56 +0000
    
    Sikertelen: 10
    Oldest: 2023-05-15 08:05:31 +0000
    Newest: 2023-07-12 18:38:28 +0000
    
    Függőben: 10
    Oldest: 2023-10-24 11:20:49 +0000
    Newest: 2023-10-31 10:23:56 +0000 Status report information
    
    Generated at: 2023-10-24 10:32:08 +00:00
    `

    Hey @flowra92 ,

    Thanks for sharing the System Status Report!

    I have gone to your site however I am unable to replicate the issue you are experiencing, as I cannot complete checkout without filling in the required fields:

    Are you able to replicate the issue on your end? If so, can you please try clearing your browser cache, or using a private/incognito browser window and see if the issue persists?

    If the issue is still present, can you please make a test purchase and share a clear screenshot of the empty required fields, as well as the successful order page after placing the order?

    If you do not already have a screenshot tool installed, Snipboard.io can be used for easily sharing screenshots.

    Also, please can you clarify the following:

    • Does this happen when specific required fields are not filled in?
    • Does this occur on various browsers?
    • Does this happen with logged-in customers, guest checkout, or both?

    Looking forward to your response!

    Hi there,

    We haven’t heard back from you in a while, I hope that you have managed to make some headway in getting this resolved!

    I’m going to mark this as resolved, however, feel free to create a new topic if you need any further help.

    Cheers!

    Thread Starter flowra92

    (@flowra92)

    Dear Roxy, Thank you for your help, this problem was solved. But i have another problem. There is a plugin on the website, which is supposed to make the VAT value zero after entering the tax number in the case of a company purchase. However, it happens sometimes that the VAT is left in, this is not related to whether the user is registered or not and I have not managed to reproduce the error yet, but unfortunately I have received orders… The coding of the extension is as follows:

    jQuery(function($) {
        var vatValidated = true; // Default to true
    
        function setLoader(loading) {
            // ... (maradhat változatlan)
        }
    
        function validateVATNumber() {
            var vatNumber = $('#billing_tax_number').val();
            var companyName = $('#billing_company').val(); // Get the company name
    
            // Check if the company name is empty
            if (companyName.trim() === '') {
                vatValidated = true; // No VAT validation required if the company name is empty
                $('button[name="woocommerce_checkout_place_order"]').prop('disabled', false); // Enable place order button
                return;
            }
    
            setLoader(true); // Show loading
    
            $.ajax({
                url: ajax_object.ajax_url,
                method: 'POST',
                dataType: 'json', // Expect JSON response from the server
                data: {
                    action: 'check_vat_number',
                    billing_tax_number: vatNumber
                },
                success: function(response) {
                    if(response.success) {
                        vatValidated = true; // VAT is valid
                    } else {
                        vatValidated = false; // VAT is invalid
                        alert('Nem megfelelő adószám formátum!');
                    }
                },
                error: function() {
                    vatValidated = false; // In case of AJAX error, consider VAT as invalid
                },
                complete: function() {
                    setLoader(false); // Hide loading
                    $('body').trigger('update_checkout');
                    // Re-check if the place order button should be enabled
                    $('button[name="woocommerce_checkout_place_order"]').prop('disabled', !vatValidated);
                }
            });
        }
    
        // Run VAT validation when the VAT number field is changed
        $('#billing_tax_number').on('change', function() {
            validateVATNumber();
        });
    
        // Check VAT validation status before placing the order
        $('form.checkout').on('checkout_place_order', function() {
            if (!vatValidated) {
                validateVATNumber(); // Re-validate VAT if not done
                return false; // Prevent the form from submitting
            }
            return true; // VAT is validated or not required, proceed with form submission
        });
    
        // Initially disable the place order button until VAT is validated
        $('button[name="woocommerce_checkout_place_order"]').prop('disabled', true);
    
        // Clear the VAT number field on page load
        $('#billing_tax_number').val('');
    });
    
    <?php
    /*
    Plugin Name: Zero ado
    Plugin URI: http://yourwebsite.com/
    Description: Validates VAT numbers during checkout and applies a zero tax rate if the VAT number is valid.
    Version: 1.0
    Author: Your Name
    Author URI: http://yourwebsite.com/
    */
    
    // Enqueueing the javascript file
    function zero_ado_scripts() {
        wp_enqueue_script('zero-ado-js', plugin_dir_url(__FILE__) . 'zero-ado.js', array('jquery'), '1.0', true);
        wp_localize_script('zero-ado-js', 'ajax_object', array('ajax_url' => admin_url('admin-ajax.php')));
    }
    add_action('wp_enqueue_scripts', 'zero_ado_scripts');
    
    // VAT number validation function
    function validate_vat_number($vat) {
        return preg_match('/^\d{8}-\d{1}-\d{2}$/', $vat);
    }
    
    // AJAX handler to validate VAT and apply zero rate
    function check_vat_number_ajax_handler() {
        if (validate_vat_number($_POST['billing_tax_number'])) {
            WC()->customer->set_is_vat_exempt(true);
            echo json_encode(['success' => true]);
        } else {
            WC()->customer->set_is_vat_exempt(false);
            echo json_encode(['success' => false, 'error' => 'Nem megfelelő adószám formátum!']);
        }
        
        WC()->cart->calculate_totals();
        wp_die();
    }
    add_action('wp_ajax_check_vat_number', 'check_vat_number_ajax_handler');
    add_action('wp_ajax_nopriv_check_vat_number', 'check_vat_number_ajax_handler');
    ?>
    

    Hey @flowra92,

    It seems you need some help with your custom code which is not working as expected for tax exemptions for companies, correct?

    Please note that custom development is outside our scope of support. It means that we only offer guidance for the default features and functionality of our products that do not require any custom code to function or integrate.
     
    We have our developer resources portal that can help you get going, so I would recommend checking it further if you need more help with this:

    https://developer.woocommerce.com/
     
    Another option is to check our customizations page to hire an expert who can create a custom solution for you: 

    https://woocommerce.com/experts/

    On the other hand, you can check out the following extensions which allow tax exemptions based on customers and/or user roles.

    WooCommerce.com offers a 30-day refund policy which you can take advantage of, allowing you to test the extension, and make sure that it suits your needs.

    Should you have any pre-sales-related questions, kindly contact us directly at WooCommerce.com → My Account → Support. You will need to create an account if you do not have one already.

    Hope this helps point you in the right direction!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Required field not working’ is closed to new replies.