Created
April 18, 2018 13:50
-
-
Save patrickposner/38ce9d3ce97a2c80b38975532eda4a92 to your computer and use it in GitHub Desktop.
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
/** | |
* Display custom cart info | |
* | |
* @param array $item_data | |
* @param array $cart_item | |
* | |
* @return array | |
*/ | |
function rbp_display_custom_cart_info( $item_data, $cart_item ) { | |
$rbp_config = get_post_meta( $cart_item['product_id'], 'rbp_role_config' ); | |
$current_user = wp_get_current_user(); | |
$customer_group = get_user_meta($current_user->ID, 'customer_group'); | |
/* | |
Hier wird der String zusammengestellt. Am besten mittels var_dump() | |
die beiden Variablen $rbp_config und $customer_group ansehen und dort die gewünschten Werte zusammenstellen. | |
Diese Daten dann bei der Variable $string im gewünschten Format einsetzen. | |
*/ | |
$string = ''; | |
$item_data[] = array( | |
'key' => __( 'Mengenrabatt', 'role-based-prices' ), | |
'value' => $string, | |
'display' => '', | |
); | |
return $item_data; | |
} | |
add_filter( 'woocommerce_get_item_data', 'rbp_display_custom_cart_info', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment