• Hi,

    This plugin does exactly what i need but im unable to get it to work.

    ive included the customisations i have made in my functions.php below but its also worth noting that i use the woocommerce table rate shipping plugin aswell so not sure if this causes an issue?

    /********************************************************************************************************
     **                                                                                                    **
     ** Checkout Field Alterations - Reorder Billing Fields                                                **
     **                                                                                                    **
     *******************************************************************************************************/
    
    // Reorder Checkout Fields
    add_filter('woocommerce_checkout_fields','reorder_woo_fields');
     
    function reorder_woo_fields($fields) {
        $fields2['billing']['billing_first_name'] = $fields['billing']['billing_first_name'];
        $fields2['billing']['billing_last_name'] = $fields['billing']['billing_last_name'];
        $fields2['billing']['billing_company'] = $fields['billing']['billing_company'];
        $fields2['billing']['billing_address_1'] = $fields['billing']['billing_address_1'];
        $fields2['billing']['billing_address_2'] = $fields['billing']['billing_address_2'];
        $fields2['billing']['billing_city'] = $fields['billing']['billing_city'];
        $fields2['billing']['billing_state'] = $fields['billing']['billing_state'];
        $fields2['billing']['billing_postcode'] = $fields['billing']['billing_postcode'];
        $fields2['billing']['billing_phone'] = $fields['billing']['billing_phone'];
        $fields2['billing']['billing_country'] = $fields['billing']['billing_country'];
    	
        $fields2['shipping']['shipping_first_name'] = $fields['shipping']['shipping_first_name'];
        $fields2['shipping']['shipping_last_name'] = $fields['shipping']['shipping_last_name'];
        $fields2['shipping']['shipping_company'] = $fields['shipping']['shipping_company'];
        $fields2['shipping']['shipping_address_1'] = $fields['shipping']['shipping_address_1'];
        $fields2['shipping']['shipping_address_2'] = $fields['shipping']['shipping_address_2'];
        $fields2['shipping']['shipping_city'] = $fields['shipping']['shipping_city'];
        $fields2['shipping']['shipping_state'] = $fields['shipping']['shipping_state'];
        $fields2['shipping']['shipping_postcode'] = $fields['shipping']['shipping_postcode'];
        $fields2['shipping']['shipping_country'] = $fields['shipping']['shipping_country'];
        $fields2['order']['order_comments'] = $fields['order']['order_comments'];
    
        return $fields2;
    }
    
      
    /********************************************************************************************************
     **                                                                                                    **
     ** Remove Checkout Unused Fields                                                                      **
     **                                                                                                    **
     *******************************************************************************************************/
    
        add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields1' );
      
     function custom_override_checkout_fields1( $fields ) {
        
        unset($fields['billing']['billing_email']); 
        
        return $fields;
    }
    
        
    /********************************************************************************************************
     **                                                                                                    **
     ** Checkout Field Alterations                                                                         **
     **                                                                                                    **
     *******************************************************************************************************/
    
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields_billing_address_1' );
    
    // Our hooked in function - $fields is passed via the filter!
    function custom_override_checkout_fields_billing_address_1( $fields ) {
         $fields['billing']['billing_company'] ['class'] = array('form-row-first');
         $fields['billing']['billing_address_1'] ['class'] = array('form-row-first');
         $fields['billing']['billing_address_2'] ['class'] = array('form-row-first');
         $fields['billing']['billing_city'] ['class'] = array('form-row-first');
         $fields['billing']['billing_state'] ['class'] = array('form-row-last');
         $fields['billing']['billing_postcode'] ['class'] = array('form-row-first');
         $fields['billing']['billing_country'] ['class'] = array('form-row-wide');
         $fields['billing']['billing_phone'] ['class'] = array('form-row-last');
        
         $fields['shipping']['shipping_company'] ['class'] = array('form-row-first');
         $fields['shipping']['shipping_address_1'] ['class'] = array('form-row-first');
         $fields['shipping']['shipping_address_2'] ['class'] = array('form-row-first');
         $fields['shipping']['shipping_city'] ['class'] = array('form-row-first');
         $fields['shipping']['shipping_state'] ['class'] = array('form-row-last');
         $fields['shipping']['shipping_postcode'] ['class'] = array('form-row-first');    
         $fields['shipping']['shipping_country'] ['class'] = array('form-row-last');
         
         $fields['billing']['billing_address_2'] ['clear'] = true;
         $fields['billing']['billing_postcode'] ['clear'] = false;
    
         $fields['shipping']['shipping_postcode'] ['clear'] = false;
         $fields['shipping']['shipping_country'] ['clear'] = true;
       
         return $fields;
    }
        
             
    /********************************************************************************************************
     **                                                                                                    **
     ** Checkout Additional Checkout Confirmation                                                          **
     **                                                                                                    **
     *******************************************************************************************************/
    
     
    add_action('woocommerce_review_order_before_submit', 'bbloomer_add_checkout_tickbox', 9);
      
    function bbloomer_add_checkout_tickbox() {
     
    ?>
     
    <p class="form-row terms">
    <input type="checkbox" class="input-checkbox" name="deliverycheck" id="deliverycheck" />
    <label for="deliverycheck" class="checkbox">I understand the Order Process and the Deadline / Delivery dates of my order<span style="color:red; font-size: 1.35em;" > *</span></label>
    </p>
     
    <?php
    }
     
    // Show notice if customer does not tick
      
    add_action('woocommerce_checkout_process', 'bbloomer_not_approved_delivery');
     
    function bbloomer_not_approved_delivery() {
        if ( ! $_POST['deliverycheck'] )
            wc_add_notice( __( 'Please acknowledge the Order Process confirmation' ), 'error' );
    }

    Hope you can help

    thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Plugin not working – is it my theme?’ is closed to new replies.