Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter codeggs.com

    (@codeggs)

    Hi,

    together with hosting provider we found a solution (which is not the best, as it changes one line in core file, but it works), in file \wp-content\plugins\litespeed-cache\src\rest.cls.php we uncommented the line 141 and the QUIC.cloud connection was then successfull. So the full function now looks like this:

    /**
    * Check if the request is from cloud nodes
    *
    * @since 4.2
    * @since 4.4.7 As there is always token/api key validation, ip validation is redundant
    */
    public function is_from_cloud() {
    return true; // Uncomment this line
    //return $this->cls('Cloud')->is_from_cloud();
    }

    For anyone else, if this piece of code is “not working”:

    /**
     * woocommerce_package_rates is a 2.1+ hook
     */
    add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 );
    
    /**
     * Hide shipping rates when free shipping is available
     *
     * @param array $rates Array of rates found for the package
     * @param array $package The package array/object being shipped
     * @return array of modified rates
     */
    function hide_shipping_when_free_is_available( $rates, $package ) {
    
     	// Only modify rates if free_shipping is present
      	if ( isset( $rates['free_shipping'] ) ) {
    
      		// To unset a single rate/method, do the following. This example unsets flat_rate shipping
      		unset( $rates['flat_rate'] );
    
      		// To unset all methods except for free_shipping, do the following
      		$free_shipping          = $rates['free_shipping'];
      		$rates                  = array();
      		$rates['free_shipping'] = $free_shipping;
    	}
    
    	return $rates;
    }

    you have to clear Woocommerce cache. You can find this in Woocommerce -> System status -> Tools -> WC Transients and click button “Clear transients“.

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