• I have a gift card plugin that allows to redeem gift cards on checkout. Below you can see the code for disabling the free shipping method when a gift card has been redeemed. I am also using free service point delivery from sendcloud when a customer reaches a certain amount. The script below does not hide the free service point delivery only the woocommers core one. Can you adjust this script in order for it to be able to hide the free service point delivery.

    I hope it a bit clear.

    function custom_woocommerce_shipping_free_shipping_is_available( $is_available, $package, $wc_shipping_method ) {
        if ( true === $is_available ) {
            $session_data = (array) WC()->session->get( PWGC_SESSION_KEY );
            if ( isset( $session_data['gift_cards'] ) && count( $session_data['gift_cards'] ) > 0 ) {
                $is_available = false;
            }
        }
    
        return $is_available;
    }
    add_filter( 'woocommerce_shipping_free_shipping_is_available', 'custom_woocommerce_shipping_free_shipping_is_available', 99, 3 );
  • The topic ‘Hide free shipping on service point delivery.’ is closed to new replies.