Skip to content

Instantly share code, notes, and snippets.

@bentasm1
Last active March 9, 2016 02:45
Show Gist options
  • Save bentasm1/76dd5d4271bc07261028 to your computer and use it in GitHub Desktop.
Save bentasm1/76dd5d4271bc07261028 to your computer and use it in GitHub Desktop.
WC Vendors Pro add custom shipping providers
// OPTION #1 -- Add additional providers to the list of what we already include with Pro. This will simply
// add more shipping providers, and keep the ones that are already there.
/* WC Vendors Pro replace shipping providers with custom list */
function custom_shipping_providers( $providers ){
$providers[ 'Country' ] = array(
'Shipping Company #1' => 'http://their-website-for-tracking.com/%1$s',
'Shipping Company #2' => 'https://another-website-for-tracking.com/?tracking=%1$s',
);
return $providers;
}
add_filter( 'wcv_shipping_providers_list', 'custom_shipping_providers' );
// OPTION #2 -- REPLACE all shipping providers, and use your custom list of them
// This will remove all shipping providers that come with Pro, and replace them ONLY
// with the ones you code below:
/* WC Vendors Pro add custom shipping providers */
/* Note: Replace 'Shipping Providers:' with whatever title you want it to display as. Leave as is otherwise. */
function custom_shipping_providers( $providers ){
$providers = array( 'Shipping Providers:' => array( // Change Your Title to something else
'Shipping Company #1' => 'http://their-website-for-tracking.com/%1$s',
'Shipping Company #2' => 'https://another-website-for-tracking.com/?tracking=%1$s',
));
return $providers;
}
add_filter( 'wcv_shipping_providers_list', 'custom_shipping_providers' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment