This file contains hidden or 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
/* WC LOGIN REDIRECT */ | |
add_filter('woocommerce_login_redirect', 'wcs_login_redirect'); | |
function wcs_login_redirect( $redirect ) { | |
$redirect = 'https://www.xxxxxxxxxxx.com/dashboard/'; | |
return $redirect; | |
} | |
/* WC REGISTER REDIRECT */ | |
add_filter('woocommerce_registration_redirect', 'wcs_register_redirect'); | |
function wcs_register_redirect( $redirect ) { | |
$redirect = 'https://www.xxxxxxxxxxxx.com/my-account/'; |
This file contains hidden or 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
function wcv_bye_bye_paypalap( $available_gateways ) { | |
global $woocommerce; | |
unset( $available_gateways['paypalap'] ); | |
return $available_gateways; | |
} | |
add_filter( 'woocommerce_available_payment_gateways', 'wcv_bye_bye_paypalap' ); |
This file contains hidden or 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
add_action('_wcv_admin_before_store_commission', 'custom_wcv_admin_before_store_commission'); | |
function custom_wcv_admin_before_store_commission(){ | |
$user_id = $_GET['user_id']; // On the WordPress user edit screen, this will get the user id of the account you are currently editing. | |
$key = get_user_meta( $user_id, '_stripe_connect_access_key', true ); | |
if ( empty( $key ) ) { | |
echo '<h2>This vendor is NOT connected to Stripe.</h2>'; | |
} else { | |
echo '<h2>This vendor is connected to Stripe. Yay!</h2>'; | |
} | |
} |
This file contains hidden or 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
/* This will warn a vendor if some magical meta key isnt set. Change it to the one you need in the code below: */ | |
// Get the users meta key we want to check. | |
$the_meta_key = get_user_meta( get_current_user_id(), 'CHANGEME', true ); // CHANGE CHANGEME TO THE META KEY NAME YOU WANT TO CHECK. | |
// DEBUG STUFF. UNCOMMENT TO CHECK STUFF. | |
// echo '<pre>THE META KEY IS: ' . $the_meta_key . '</pre>'; | |
// Check if meta key is set | |
if (!isset($the_meta_key)) { |
This file contains hidden or 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
function filter_gateways($gateways){ | |
global $woocommerce; | |
$thewinner = rand(1,5); | |
if ($thewinner == 1 ) { | |
unset($gateways['gateway2']); | |
unset($gateways['gateway3']); | |
unset($gateways['gateway4']); | |
unset($gateways['gateway5']); |
This file contains hidden or 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
/* WC Vendors Pro - Change the Settings tab on the Pro Dashboard navigation to say "New Label" (or whatever) instead */ | |
function custom_menu_link( $pages ) { | |
$pages[ 'settings' ] = array( | |
'slug' => 'settings', | |
'label' => __('New Label', 'wcvendors-pro' ), | |
'actions' => array() | |
); | |
return $pages; | |
} |
This file contains hidden or 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
// Set Vendors Store Icon as Open Graph image on shop page | |
function my_opengraph_image( $img ) { | |
if ( WCV_Vendors::is_vendor_page() ) { | |
$vendor_shop = urldecode( get_query_var( 'vendor_shop' ) ); | |
$vendor_id = WCV_Vendors::get_vendor_id( $vendor_shop ); | |
$store_icon_src = wp_get_attachment_image_src( get_user_meta( $vendor_id, '_wcv_store_icon_id', true ), 'full' ); | |
// see if the array is valid | |
if ( is_array( $store_icon_src ) ) { | |
$img = $store_icon_src[0]; |
This file contains hidden or 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 | |
// Add this to your themes function.php | |
add_filter( 'woocommerce_cart_item_name', 'wcv_shipping_cart_item', 1, 3 ); | |
function wcv_shipping_cart_item( $title = null, $cart_item = null, $cart_item_key = null ) { | |
$settings = get_option( 'woocommerce_wcv_pro_vendor_shipping_settings' ); | |
$customer_address = array( 'country' => WC()->customer->get_shipping_country(), 'state' => WC()->customer->get_shipping_state() ); | |
$package = array( 'destination' => $customer_address ); |
This file contains hidden or 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
/* WC Vendors Pro -- Provides a custom list of countries, instead of all of them. The syntax */ | |
/* on this is pretty easy, just make sure you have the correct 2 letter country code */ | |
/* This example will show only UK and USA and ignore all others */ | |
add_filter('wcv_countries_list', 'custom_wcv_countries_list'); | |
function custom_wcv_countries_list(){ | |
$args = array( | |
'GB' => __( 'United Kingdom (UK)', 'wcvendors-pro' ), | |
'US' => __( 'United States (US)', 'wcvendors-pro' ) | |
); | |
return $args; |
This file contains hidden or 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 | |
// This code goes in your theme's functions.php | |
function form_caracteristica( $object_id ) { | |
WCVendors_Pro_Form_helper::select( array( | |
'post_id' => $object_id, | |
'id' => 'wcv_custom_product_caracteristicas', | |
'class' => 'select2', | |
'label' => __('Caracteristicas', 'wcvendors-pro'), | |
'show_option_none' => __('Select a caracteristicas', 'wcvendors-pro'), |
NewerOlder