2014-12-05 57 views
1

我正在使用WooCommerce建立网上商店。我的地址的设置是这样的:1。 帐单地址 2.复选框:创建帐户(如果尚未登入) 3复选框:船到不同的地址WooCommerce - 在结帐时创建帐户时出错

因此,当客户检查框“创建帐户” ,他们必须填写密码。我希望将帐单地址信息用于帐单和送货地址(默认情况下)。但是,如果客户现在选中“创建帐户”复选框并将“发送到不同地址”留在未选中状态,表单会提供错误消息,说明客户也需要填写送货地址字段。我的结算代码如下(帐单地址字段&创建帐户复选框;请注意更多代码)。

我希望有人有一个解决方案。谢谢。

<div class="woocommerce-billing-fields"> 
    <?php if (WC()->cart->ship_to_billing_address_only() && WC()->cart->needs_shipping()) : ?> 

     <h2><?php _e('Billing &amp; Shipping', 'woocommerce'); ?></h2> 
    <?php else : ?> 
    <?php endif; ?> 

    <?php do_action('woocommerce_before_checkout_billing_form', $checkout); ?> 

    <?php foreach ($checkout->checkout_fields['billing'] as $key => $field) : ?> 

     <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?> 

    <?php endforeach; ?> 

    <?php do_action('woocommerce_after_checkout_billing_form', $checkout); ?> 

    <?php if (! is_user_logged_in() && $checkout->enable_signup) : ?> 
     <div class="create-account-wrapper"> 
      <?php if ($checkout->enable_guest_checkout) : ?> 

       <p class="form-row form-row-wide create-account-title walsheim checkbox-wrapper"> 
        <input class="input-checkbox" id="createaccount" <?php checked((true === $checkout->get_value('createaccount') || (true === apply_filters('woocommerce_create_account_default_checked', false))), true) ?> type="checkbox" name="createaccount" value="1" /> <label for="createaccount" class="checkbox"><?php _e('create an account', 'woocommerce'); ?></label> 
       </p> 

      <?php endif; ?> 

      <?php do_action('woocommerce_before_checkout_registration_form', $checkout); ?> 

      <?php if (! empty($checkout->checkout_fields['account'])) : ?> 

       <div class="create-account create-account-content"> 

        <p><?php _e('Create an account by entering the information below. If you are a returning customer please login at the top of the page.', 'woocommerce'); ?></p> 

        <?php foreach ($checkout->checkout_fields['account'] as $key => $field) : ?> 

         <?php woocommerce_form_field($key, $field, $checkout->get_value($key)); ?> 

        <?php endforeach; ?> 

        <div class="clear"></div> 

       </div> 

      <?php endif; ?> 

      <?php do_action('woocommerce_after_checkout_registration_form', $checkout); ?> 
     </div> 

    <?php endif; ?> 
</div> 

回答

0

有标记Shipping Destinationshipping选项卡下的woocoomerce设置页面的选项。尝试选择Default to billing address选项。