Answers for "Woocommerce custom Flat Rate charges (by ID) Function"

PHP
0

Woocommerce custom Flat Rate charges (by ID) Function

function wc_ninja_change_flat_rates_cost( $rates, $package ) {

  // Make sure flat rate is available
  // '13' is Flat Rate ID (What you Define)
	if ( isset( $rates['flat_rate:13'] ) ) {
		// Set the cost to $100
		$rates['flat_rate:13']->cost = 60;
		
	}
		return $rates;
}

add_filter( 'woocommerce_package_rates', 'wc_ninja_change_flat_rates_cost', 10, 2 );
Posted by: Guest on November-19-2020

Code answers related to "Woocommerce custom Flat Rate charges (by ID) Function"

Browse Popular Code Answers by Language