Created
October 26, 2017 11:18
-
-
Save twern/bd255689e72e6e7dd3bd58d25dd0a69d to your computer and use it in GitHub Desktop.
RBP - AP 20946
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
add_filter( 'woocommerce_single_product_summary', 'show_rbp_price_of_different_group', 10 ); | |
function show_rbp_price_of_different_group() { | |
// nur wenn der user nicht eingeloggt ist | |
if ( ! is_user_logged_in() ) { | |
// init | |
global $product; | |
$price = $product->get_price(); | |
$rbp_config = $product->get_meta( 'rbp_role_config' ); | |
// finde die gruppe "besondere" | |
$special_group = 'besondere'; // dies anpassen | |
if ( isset( $rbp_config[ $special_group ] ) ) { | |
$config = $rbp_config[ $special_group ]; | |
// Preis für diese Gruppe ausgeben | |
$config_group_price = $config[ 'group_price' ]; | |
if ( $config_group_price[ 'price_type' ] == 'currency' ) { | |
echo sprintf( 'Als "Besonderer Kunde" würde Sie das Produkt nur %s kosten', wc_price( $config_group_price[ 'price' ] ) ); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment