Skip to content

Instantly share code, notes, and snippets.

@twern
Created October 26, 2017 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twern/bd255689e72e6e7dd3bd58d25dd0a69d to your computer and use it in GitHub Desktop.
Save twern/bd255689e72e6e7dd3bd58d25dd0a69d to your computer and use it in GitHub Desktop.
RBP - AP 20946
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