• Hello,

    since the update, the option of choosing the pick-up point is no longer displayed when confirming the order.

    Thank you in advance,

    Mathieu

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • @coteproducteurs my little solution is in Woocommerce code: https://docs.woocommerce.com/document/hide-other-shipping-methods-when-free-shipping-is-available/

    Change: if (‘local_pickup’ === $rate->method_id )
    For: if (‘wc_pickup_store’ === $rate->method_id )

    function hide_shipping_when_free_is_available( $rates, $package ) {
    	$new_rates = array();
    	foreach ( $rates as $rate_id => $rate ) {
    		// Only modify rates if free_shipping is present.
    		if ( 'free_shipping' === $rate->method_id ) {
    			$new_rates[ $rate_id ] = $rate;
    			break;
    		}
    	}
    
    	if ( ! empty( $new_rates ) ) {
    		//Save local pickup if it's present.
    		foreach ( $rates as $rate_id => $rate ) {
    			if ('wc_pickup_store' === $rate->method_id ) {
    				$new_rates[ $rate_id ] = $rate;
    				break;
    			}
    		}
    		return $new_rates;
    	}
    
    	return $rates;
    }
    
    add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
Viewing 1 replies (of 1 total)
  • The topic ‘Display issue’ is closed to new replies.