You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

WooCommerce Local Pickup Plus技术问题:感谢页订单详情不显示取货信息+选择自提仍需填写账单地址

Fixes for Divi + WooCommerce Local Pickup Plus Issues

Let’s work through these two common hiccups with your setup—here’s actionable steps to resolve each one:

1. $pickup_meta Returns Empty, No Pickup Details on Thank You Page

An empty $pickup_meta usually means the plugin isn’t saving pickup data properly, or the template isn’t pulling it correctly. Try these fixes:

  • Verify Pickup Data is Saved to the Order
    Head to your WordPress admin, open the problematic order, and enable the "Custom Fields" section (via Screen Options if it’s hidden). Look for a meta key like _wc_local_pickup_plus_pickup_data—if it’s missing or empty, the plugin isn’t storing pickup info. First, update WooCommerce, Divi, and Local Pickup Plus to their latest stable versions to rule out compatibility gaps.

  • Debug the Template Data
    Temporarily add a debug line to your Local Pickup Plus order details template to check if $pickup_data itself has content:

    <?php var_dump($pickup_data); // Remove after testing ?>
    

    If $pickup_data is empty, replace the existing data fetch with a direct meta call to bypass context issues:

    <?php $pickup_data = $order->get_meta('_wc_local_pickup_plus_pickup_data'); ?>
    
  • Add a Guard Clause for Empty Meta
    Prevent blank output by skipping empty $pickup_meta entries in your template loop:

    <?php foreach ( $pickup_data as $pickup_meta ) : ?>
        <?php if ( empty($pickup_meta) ) continue; // Skip empty packages ?>
        <div>
            <?php if ( $packages_count > 1 ) : ?>
                <h5><?php echo sprintf( is_rtl() ? '#%2$s %1$s': '%1$s #%2$s', esc_html( $shipping_method->get_method_title() ), $package_number ); ?></h5>
            <?php endif; ?>
            <?php foreach ( $pickup_meta as $label => $value ) : ?>
                <?php if ( is_rtl() ) : ?>
                    <small><?php echo wp_kses_post( $value ); ?> <strong>:<?php echo esc_html( $label ); ?></strong></small><br />
                <?php else : ?>
                    <small><strong><?php echo esc_html( $label ); ?>:</strong> <?php echo wp_kses_post( $value ); ?></small><br />
                <?php endif; ?>
            <?php endforeach; ?>
            <?php if ( $packages_count > 1 && $package_number <=$packages_count ) : ?>
                <br />
            <?php endif; ?>
            <?php $package_number++; ?>
        </div>
    <?php endforeach; ?>
    
  • Check for Plugin Conflicts
    Disable all plugins except WooCommerce, Local Pickup Plus, and Divi, then test a new order. If pickup details appear, re-enable plugins one by one to find the conflicting one.

2. Billing Address Error Even When Selecting Local Pickup

This happens when WooCommerce’s default required fields aren’t being overridden by Local Pickup Plus. Try these fixes:

  • Configure Local Pickup Plus Address Settings
    Go to WooCommerce > Settings > Shipping > Local Pickup Plus and look for the "Address Requirements" section. Set it to "No billing address required" (or equivalent) to tell the plugin to skip billing fields for pickup orders.

  • Force Skip Billing Fields with Code
    If plugin settings don’t work, add this code to your child theme’s functions.php file or a custom functionality plugin:

    // Disable required billing fields for Local Pickup Plus
    add_filter( 'woocommerce_billing_fields', 'skip_billing_fields_for_local_pickup', 20, 1 );
    function skip_billing_fields_for_local_pickup( $fields ) {
        $chosen_shipping = WC()->session->get( 'chosen_shipping_methods' );
        if ( ! empty( $chosen_shipping ) && strpos( $chosen_shipping[0], 'local_pickup_plus' ) !== false ) {
            // Unset required status for billing fields
            $fields['billing_first_name']['required'] = false;
            $fields['billing_last_name']['required'] = false;
            $fields['billing_address_1']['required'] = false;
            $fields['billing_city']['required'] = false;
            $fields['billing_postcode']['required'] = false;
            $fields['billing_country']['required'] = false;
            $fields['billing_phone']['required'] = false;
        }
        return $fields;
    }
    
    // Remove billing fields from required checkout validation
    add_filter( 'woocommerce_checkout_fields_required', 'remove_required_fields_for_local_pickup', 20, 1 );
    function remove_required_fields_for_local_pickup( $required_fields ) {
        $chosen_shipping = WC()->session->get( 'chosen_shipping_methods' );
        if ( ! empty( $chosen_shipping ) && strpos( $chosen_shipping[0], 'local_pickup_plus' ) !== false ) {
            foreach ( $required_fields as $key => $_ ) {
                if ( str_starts_with( $key, 'billing_' ) ) {
                    unset( $required_fields[$key] );
                }
            }
        }
        return $required_fields;
    }
    
  • Check Divi’s Checkout Template
    Divi sometimes uses custom checkout modules that ignore WooCommerce’s field settings. Update Divi to the latest version, or switch to the default WooCommerce checkout template temporarily to see if the error goes away.

内容的提问来源于stack exchange,提问作者ZiaUllahZia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.27 14:37:40