• Resolved VT

    (@waclawnetwork)


    Is this actual solution in topic “Variable Product, Virtual selected BUT shipping still”? I try to use this code:

    add_filter( 'woocommerce_checkout_fields' , 'bbloomer_simplify_checkout_virtual' );
     
    function bbloomer_simplify_checkout_virtual( $fields ) {
        
       $only_virtual = true;
        
       foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
          // Check if there are non-virtual products
          if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false;   
       }
         
        if( $only_virtual ) {
           unset($fields['billing']['billing_company']);
           unset($fields['billing']['billing_address_1']);
           unset($fields['billing']['billing_address_2']);
           unset($fields['billing']['billing_city']);
           unset($fields['billing']['billing_postcode']);
           unset($fields['billing']['billing_country']);
           unset($fields['billing']['billing_state']);
           unset($fields['billing']['billing_phone']);
           add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
         }
         
         return $fields;
    }

    Nothing’s changes. Virtual Simple Product – and Page “Checkout” contain “Billing address”. Please help)

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi there @waclawnetwork, thank you for reaching out.

    If I understand you correctly, you are having an issue at checkout with shipping, as it is asked for when a variable product, virtual product are selected. Is that correct?

    I also noticed you searched for a solution from the forum and found the code from this thread here.

    In order to assist you further, we need to understand how your site is set up and how the product page is also set up. Please send us a screenshot of your product page settings and a system status report which you can find via WooCommerce > Status > Get system report > Copy for support.

    For the screenshot, you can use a screenshot sharing software like https://snipboard.io/ and for the systems status report, you could copy and paste it via https://gist.github.com/ and send the link here.

    Thread Starter VT

    (@waclawnetwork)

    Yes, that is absolutely correct. Thank You.

    https://snipboard.io/LHolXS.jpg

    https://snipboard.io/KOj1E0.jpg

    `
    ### WordPress Environment ###
    
    WordPress address (URL): https://1.local
    Site address (URL): https://1.local
    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: 256 MB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: nginx/1.16.0
    PHP Version: 8.1.23
    PHP Post Max Size: 1,000 MB
    PHP Time Limit: 1200
    PHP Max Input Vars: 4000
    cURL Version: 7.77.0
    OpenSSL/1.1.1t
    
    SUHOSIN Installed: –
    MySQL Version: 8.0.16
    Max Upload Size: 300 MB
    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 Database Size: 5.26MB
    Database Data Size: 3.57MB
    Database Index Size: 1.69MB
    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.02MB + 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.08MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_options: Data: 2.48MB + Index: 0.06MB + Engine InnoDB
    wp_postmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_posts: Data: 0.06MB + 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.02MB + Index: 0.03MB + Engine InnoDB
    wp_users: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.05MB + 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.02MB + Index: 0.02MB + 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
    
    ### Post Type Counts ###
    
    attachment: 1
    page: 7
    post: 2
    product: 1
    revision: 2
    shop_order_placehold: 1
    wp_global_styles: 1
    wp_navigation: 1
    wp_template: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    					Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
    Hide errors from visitors: ?
    
    ### Active Plugins (1) ###
    
    WooCommerce: by Automattic – 8.5.2
    
    ### Inactive Plugins (0) ###
    
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: RUB (?)
    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: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
    HPOS data sync enabled: –
    
    ### 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: Kadence Child
    Version: 1.0.0
    Author URL: https://www.kadencewp.com/
    Child Theme: ?
    Parent Theme Name: Kadence
    Parent Theme Version: 1.1.51
    Parent Theme Author URL: https://www.kadencewp.com/
    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
    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-29 10:20:55 +00:00
    Options: ?
    Notes: 68
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Complete: 32
    Oldest: 2024-01-26 10:22:23 +0000
    Newest: 2024-01-29 09:40:45 +0000
    
    Failed: 1
    Oldest: 2024-01-26 10:23:53 +0000
    Newest: 2024-01-26 10:23:53 +0000
    
    Pending: 1
    Oldest: 2024-01-30 09:32:36 +0000
    Newest: 2024-01-30 09:32:36 +0000
    
    
    ### Status report information ###
    
    Generated at: 2024-01-29 09:41:19 +00:00
    `
    • This reply was modified 10 months ago by VT.
    • This reply was modified 10 months ago by VT.
    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @waclawnetwork,

    Thanks for sharing additional information.

    Since you’re using the latest version of WC, are you using the checkout block or shortcode on your checkout page? Just a heads up, if you’re using the checkout block, the code snippet you’re using may not function properly.

    [woocommerce_checkout]

    If you are using Block and planning to keep using it, then you might need to use an additional plugin like Conditional Checkout Field Editor for WooCommerce.

    I hope this clarifies your concern. If you have any other questions, feel free to ask.

    Thread Starter VT

    (@waclawnetwork)

    Thank you! Now it is clear. Is there a free plugin? Which one can you recommend?

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @waclawnetwork,

    There are several third-party plugins that can help achieve your desired results, however, as you require a free plugin, please check out this external post with several of those plugins highlighted.

    I hope this helps.

    Thread Starter VT

    (@waclawnetwork)

    Awesome! Thank You!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Is this actual solution: Variable Product, Virtual selected BUT shipping still’ is closed to new replies.