• Resolved tin_soldier

    (@tin_soldier)


    I’d like all shipping options to show even if free shipping conditions are met but your plugin seems to hide them.
    I’ve tried adding a function to override this such as:

    add_filter( 'woocommerce_package_rates', 'show_all_shipping_methods', 200 );
    
    function show_all_shipping_methods( $rates ) {
        $free = array();
        foreach ( $rates as $rate_id => $rate ) {
            if ( 'free_shipping' === $rate->method_id ) {
                $free[ $rate_id ] = $rate;
            }
        }
        return ! empty( $free ) ? array_merge( $rates, $free ) : $rates;
    }

    But nothing seems to work. What can I do please?

Viewing 1 replies (of 1 total)
  • Plugin Support usecaddy

    (@usecaddy)

    Well add an option to turn this off in the future. In the meantime, you can try:

    // Function to remove the shipping filter
    function remove_cc_shipping_when_free_is_available() {
    // Check if the Caddy_Public class and the method exist
    if (class_exists('Caddy_Public') && method_exists('Caddy_Public', 'cc_shipping_when_free_is_available')) {
    // Get an instance of the Caddy_Public class
    $caddy_public_instance = new Caddy_Public();

    // Remove the filter
    remove_filter('woocommerce_package_rates', array($caddy_public_instance, 'cc_shipping_when_free_is_available'), 10);
    }
    }

    // Hook into WordPress after all plugins are loaded
    add_action('plugins_loaded', 'remove_cc_shipping_when_free_is_available', 20);
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.