Created
May 27, 2017 16:34
-
-
Save vince844/79101f573ed8b60ae0bc3a3ef2f7b7ae to your computer and use it in GitHub Desktop.
Woocommerce and Groups Integration
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
// @karibusana.org Funzione per indirizzare gli utenti a diversi negozi a seconda del loro gruppo di appartenenza | |
function karibusana_change_woocommerce_button_url() { | |
$user_id = get_current_user_id(); | |
$group = Groups_Group::read_by_name( 'Rivenditori' ); // Qui specifica il nome del gruppo per il quale eseguire il redirect | |
if ( Groups_User_Group::read( $user_id, $group->group_id ) ) { | |
$redirect_to = get_permalink( 1054 ); // inserisci qui l'id dela pagina rivenditori | |
return $redirect_to; | |
}else{ | |
$redirect_to = get_permalink( 108 ); // inserisci qui l'id della pagina negozio generale | |
return $redirect_to; | |
} | |
} | |
add_filter( 'woocommerce_return_to_shop_redirect', 'karibusana_change_woocommerce_button_url' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment