Created
June 17, 2022 12:43
-
-
Save bporcelli/654cdb2828293c20def98849f7c039b1 to your computer and use it in GitHub Desktop.
[MarketShip] Enable USPS flat rate services by default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Filters the default value of the marketship_shippo_usps_settings | |
* user meta key to enable flat rate services by default. | |
* | |
* @param mixed $value Meta value. | |
* @param int $user_id User ID. | |
* @param string $meta_key Meta key. | |
* @param bool $single Whether to return a single value. | |
* | |
* @return array|string | |
*/ | |
function marketship_filter_default_usps_settings( $value, $user_id, $meta_key, $single ) { | |
if ( 'marketship_shippo_usps_settings' !== $meta_key ) { | |
return $value; | |
} | |
$default_settings = array( | |
'enable_flat_rate_services' => 'yes', | |
); | |
return $single ? $default_settings : array( $default_settings ); | |
} | |
add_filter( 'default_user_metadata', 'marketship_filter_default_usps_settings', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment