Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter todd.lynch

    (@toddlynch)

    Thanks Caleb.
    I have read this article numerous times and have tried to override the placeholder, but the checkout form still loads the database information. I think I need to prevent the fields from being loaded in the first place, but am having problems trying to figure this out.

    Thank you jnz31 this seems to solve the problem. I had used a stylesheet to cover these up (messy), but your method is much simpler and more reliable!
    I don’t suppose you know how to prevent the wcpgsk saved information being loaded into the checkout fields?
    I created a select menu & date billing address field using wcpgsk but I don’t want the saved information from a returning customer to be loaded. I would like them to pick a new one each time they order.
    Here is my current post relating to this:
    https://www.ads-software.com/support/topic/woocommerce-unloading-fields-in-checkout

    Hi again!
    I just discovered I was having this same issue too.
    I downloaded the release on GitHub and installed as per your comments.
    I can confirm that this does solve the problem, however I am getting this error in the dashboard: Paypal Plus error: Please enter your Rest API Cient ID and Secret ID here
    I am unable to remove this message or change Paypal Plus:
    Gateway Disabled: PayPal Plus does not support your store currency (Supports: EUR, CAD).

    Will this release fix any issues I had with custom fields too?

    I am having this same problem.
    Do you have any code I can put in the functions file to overcome this?
    I am trying to hide the custom billing fields I created in the my account and edit billing address page.
    I only want them to show up on the checkout page.

    Thread Starter todd.lynch

    (@toddlynch)

    OK – thank you.

    I have solved my issues by re-writing my code around the Woocommerce Poor Guys Swiss Knife Version 2.2.4 plugin.

    The plugin is much better than all the others in my opinion anyway.

    Thread Starter todd.lynch

    (@toddlynch)

    OK – so I thought I’d try a little test.

    I completely removed all my custom code.

    Then I installed 5 plugins that enable you to add custom fields at checkout. I enabled them one at a time for each test.

    All plugins passed the direct debit method test.

    The following plugins failed using PayPal:
    Booster for WooCommerce Version 2.2.9
    WooCommerce Checkout Field Editor Version 1.3.1
    Order Delivery Date for WooCommerce (Lite version) Version 1.6
    WooCommerce Checkout Manager Version 3.6.8

    The only plugin that passed both tests was:
    Woocommerce Poor Guys Swiss Knife Version 2.2.4

    Looks like I’ll need to delve into the code a bit more.

    If you have any further thoughts, please let me know.

    Thread Starter todd.lynch

    (@toddlynch)

    Sorry I should have already told you that I have done this.
    I didn’t think my code would pass anything unless it was passed from the checkout so have put the Paypal Express checkout in the checkout page only.

    PayPal Express Checkout option:
    Checkout Page Display: Display in general list of enabled gatways on checkout page.

    So to answer your question.

    Express Checkout is set so that it is included in the general list of gateways on my checkout page, and the problem still occurs.

    Any ideas?

    Thread Starter todd.lynch

    (@toddlynch)

    It doesn’t show in Woocommerce order details, meta or send the info in emails.
    I am also using Order Delivery Date for WooCommerce (Lite version).
    The code below picks out what delivery method the customer is using to send the goods. If it’s a flat rate, then the user must decide whether or not to use authority to leave (ATL). Or if the customer selects local pick up, they must fill in the Order Delivery Date as provided by the above mentioned plugin.

    The code below may be buggy, but I spent countless hours searching for ideas on how to get it right, and it does work when using direct debit as the payment method. The custom code seems to be lost when using Paypal Express.

    You can view it working here (once you have added items to your cart):
    https://newsite.rangeproducts.com.au/cart/

    Here is my code:

    /**
     * Add Authority to Leave select dropdown in checkout page
     **/
    
    add_filter( 'woocommerce_checkout_fields' , 'custom_atl_field');
    
    function custom_atl_field( $fields ) {
    	 $fields['billing']['atl'] = array(
         'type'     => 'select',
         'options'  => array(
         '' => 'Please Select',
         'Yes' => 'Yes',
         'No' => 'No'),
         'label'     => __('Authority to Leave?</br><small style=font-size:10px;font-weight:normal;>If you are having your order delivered, please let us know if we have the authority to leave goods if no one there.</small>', 'woocommerce'),
         'required'  => false,
         'class'     => array('atl form-row-left'),
         'clear'     => true
         );
    
         return $fields;
    }
    
    //ATL question mandatory based on shipping method flat_rate
    add_filter( 'woocommerce_checkout_fields', 'atl_disable' );
    function atl_disable( $atl ) {
        global $woocommerce;
        $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
        $chosen_shipping = $chosen_methods[0];
    
        if( $chosen_shipping == 'flat_rate' ) {
    /**
     * Process the ATL checkout
     */
    add_action('woocommerce_checkout_process', 'my_custom_checkout_atl_process');
    
    function my_custom_checkout_atl_process() {
        // Check if set, if its not set add an error.
        if ( ! $_POST['atl'] )
            wc_add_notice( __( 'You have chosen us to deliver your order. Please answer Authority to Leave question.' ), 'error' );
    	else
    		/**
     * Update the order meta with ATL question
     **/
    add_action( 'woocommerce_checkout_update_order_meta', 'store_atl_update_order_meta' );
    function store_atl_update_order_meta( $order_id ) {
                    if ( $_POST[ 'atl' ] )
                                    update_post_meta( $order_id, 'Authority to Leave', esc_attr( $_POST[ 'atl' ] ) );
    }
    /**
     * Add the ATL custom fields to order emails
     **/
    add_filter('woocommerce_email_order_meta_keys', 'my_atl_checkout_field_order_meta_keys');
    function my_atl_checkout_field_order_meta_keys( $keys ) {
    	$label_name = __("Authority to Leave","atl");
    	$keys[$label_name] = "Authority to Leave";
        return $keys;
    }
    }
    
        }
    
        return $atl;
    
    }
    
    //Pickup question mandatory based on shipping method local_pickup
    add_filter( 'woocommerce_checkout_fields', 'local_pickup_disable' );
    function local_pickup_disable( $local_pickup ) {
        global $woocommerce;
        $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
        $chosen_shipping = $chosen_methods[0];
    
        if( $chosen_shipping == 'local_pickup' ) {
    /**
     * Process the local_pickup checkout
     */
    add_action('woocommerce_checkout_process', 'my_custom_checkout_local_pickup_process');
    
    function my_custom_checkout_local_pickup_process() {
        // Check if set, if its not set add an error.
        if ( ! $_POST['e_deliverydate'] )
            wc_add_notice( __( 'Please let us know when you plan to pick up your order by selecting a collection date.' ), 'error' );
    	else
    		/**
    * Update the order meta with Pick Up question
    **/
    add_action('woocommerce_checkout_update_order_meta', 'my_pickup_field_update_order_meta', 10, 2);
    function my_pickup_field_update_order_meta( $order_id, $posted ) {
        if ( $_POST['e_deliverydate'] ) {
            update_post_meta( $order_id, '_e_deliverydate', esc_attr($_POST['e_deliverydate']));
        }
    }
    /**
     * Add the Pick Up custom fields to order emails
     **/
    add_filter('woocommerce_email_order_meta_keys', 'my_pickup_checkout_field_order_meta_keys');
    function my_pickup_checkout_field_order_meta_keys( $keys ) {
    	$label_name = __("Pick Up Date","e_deliverydate");
    	$keys[$label_name] = "Pick Up Date";
        return $keys;
    }	
    
    }
    
        }
    
        return $local_pickup;
    
    }
    /**
    * Display ATL field value on the order edit page
    **/
    add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_atl_field_display_admin_order_meta', 10, 1 ); 
    
    function my_atl_field_display_admin_order_meta($order){
    echo '<p><strong>'.__('Authority to Leave').':</strong> ' . get_post_meta( $order->id, 'Authority to Leave', true ). '</p>';
    }
    /**
    * Display Pick Up field value on the order edit page
    **/
    add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_pickup_field_display_admin_order_meta', 10, 1 ); 
    
    function my_pickup_field_display_admin_order_meta($order){
    echo '<p><strong>'.__('Pick Up Date').':</strong> ' . $order->e_deliverydate. '</p>';
    }
Viewing 8 replies - 1 through 8 (of 8 total)