Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter afmedia

    (@afmedia)

    Thank you for your response ! Do you know when you will be able to release the next version ?

    Edit to my previous post, the code doesn’t work when I first load the cart page, the local-pickup-time-select field isn’t displayed.

    I’m on WP 5.4 and woocommerce 4.0.1
    Any advice would be great !

    Hello,
    a minor improvement to @yward code in the case of having chosen a pickup time and then change the shipping to mailing : we have to empty the pickup time otherwise a date will be displayed in the backoffice.

    <?php
    //hide the local pickup thingy
    add_action( 'woocommerce_after_checkout_form', 'bbloomer_disable_shipping_local_pickup' );
      
    function bbloomer_disable_shipping_local_pickup( $available_gateways ) {
        
       // Part 1: Hide time based on the static choice @ Cart
     
       $chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
       $chosen_shipping = $chosen_methods[0];
      if ( 0 !== strpos( $chosen_shipping, 'local_pickup' ) ) {
       ?>
          <script type="text/javascript">
             jQuery('#local-pickup-time-select').fadeOut();
          </script>
       <?php  
       } 
    	else {
    		?>
    		<script type="text/javascript">
    		if(jQuery('#local_pickup_time_select').val()) {<?php
    			wc_add_notice( __( 'Veuillez choisir un horaire de retrait.', 'woocommerce-local-pickup-time' ), 'error' );
    		?>}   </script>
    	<?php
       } 
       
       // Part 2: Hide time based on the dynamic choice @ Checkout
     
       ?>
    	<script type="text/javascript">
             jQuery('form.checkout').on('change','input[name^="shipping_method"]',function() {
                var val = jQuery( this ).val();
                if (val.match("^local_pickup")) {
    				jQuery('#local-pickup-time-select').fadeIn();	
                   } else {
                   jQuery('#local-pickup-time-select').fadeOut();
    			   jQuery('#local_pickup_time_select').val("none");
                } 
             });
          </script>
       <?php
      
    }
    add_action( 'woocommerce_after_checkout_validation', 'a4m_validate_pickup', 10, 2);
     
    function a4m_validate_pickup( $fields, $errors ){
    	$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
    	$chosen_shipping = $chosen_methods[0];
     if ( 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
        if ( empty($_POST[ 'local_pickup_time_select' ] ) ){
            $errors->add( 'validation', 'Veuillez choisir un horaire de retrait.' );
        }
     }
    } 
    //end of it
    ?>

    Hello,
    sorry to bring back the subject but I need this function too.
    I have tried what @yward kindly wrote but I can’t get it to work.
    Here is the code I have put in function.php in my child theme.
    Even if I choose shipping by post , I can’t get rid of the local pick up time selection. I also found an error about json when I look in the browser console.
    Any help is most welcome 🙂 Thank you in advance

     add_action( 'woocommerce_after_checkout_validation', 'a4m_validate_pickup', 10, 2);
     
    function a4m_validate_pickup( $fields, $errors ){
    	$chosen_methods = WC()->session->get( 'chosen_shipping_methods' );
    	$chosen_shipping = $chosen_methods[0];
     if ( 0 === strpos( $chosen_shipping, 'local_pickup' ) ) {
        if ( empty($_POST[ 'local_pickup_time_select' ] ) ){
            $errors->add( 'validation', 'Veuillez choisir un horaire de retrait.' );
        }
     }
    ?>
    	<script type="text/javascript">
             jQuery('form.checkout').on('change','input[name="shipping_method"]',function() {
                var val = jQuery( this ).val();
                if (val.match("local_pickup")) {
    				jQuery('#local-pickup-time-select').fadeIn();	
    if(jQuery('#local_pickup_time_select').val()) {<?php
    			wc_add_notice( __( 'Veuillez choisir un horaire de retrait.', 'woocommerce-local-pickup-time' ), 'error' );
    		?>}
                   } else {
                   jQuery('#local-pickup-time-select').fadeOut();
                } 
             });
          </script>
       <?php
      
    } 
    //end of it
    Thread Starter afmedia

    (@afmedia)

    Thanks, it works perfectly !

    Thread Starter afmedia

    (@afmedia)

    Hi, thank you 🙂
    Is there a way to make it responsive ?

    Thanks

    afmedia

    (@afmedia)

    Hi,
    I’ve just installed the plugin and I have the same issue with the french translation.
    But it works…
    Best regards

    • This reply was modified 9 years ago by afmedia.
    Thread Starter afmedia

    (@afmedia)

    Hi devon, i won t have access to a computer this week, to send you screenshot but the permalink looks like
    Mysite.com/%category%-st-malo/%postname%/%post_id%/

    And the htaccess is
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    Thanks for your help,

    Amandine

    Thread Starter afmedia

    (@afmedia)

    Hi,

    I’ve just sent you an email via your contact form.

    Thank you,

    AF

    Thread Starter afmedia

    (@afmedia)

    Thanks for the response.
    I tried ShortPixel but it gives me an error :
    Error downloading file (http://api.shortpixel.com/f/e1e35e447b9465285d7de7b1b2618ab7-lossy.jpg) Timeout was reached

    Thread Starter afmedia

    (@afmedia)

    Hi Devon,

    thank you for your response.
    I tried with the Twenty Sixteen theme and unfortunatly it doesn’t work, I’ve the same issue with 404 errors.

    I also tried desactivating all the other plugins without any success.

    It’s a nice and efficient plugin, that do exactly what I need so I would really like to make it work !

    Thank you for the support,

    Amandine

    Hi,

    I’ve got the same problem : all post notif pages (confirmation and preferences) shows 404 errors.

    – I use a genesis theme
    – custom permalinks : /%category%-st-malo/%postname%/%post_id%/

    Any help will be appreciated ! 🙂

    Thanks in advance,

    AF

Viewing 12 replies - 1 through 12 (of 12 total)