Skip to content

Instantly share code, notes, and snippets.

Created June 16, 2017 16:14
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 anonymous/237ca705fbe970ba06b86a22d3fe1d90 to your computer and use it in GitHub Desktop.
Save anonymous/237ca705fbe970ba06b86a22d3fe1d90 to your computer and use it in GitHub Desktop.
add_filter('agp_current_settings', 'agp_current_settings',1,1);
function agp_current_settings($options){
if (is_product()){
global $post;
$product = wc_get_product( $post->ID );
$id = $product->get_id();
$postMeta = get_post_meta($id, 'Verkauf_ab', true);
if($postMeta = '18'){
$options['min_age']=18;
}elseif($postMeta = '16'){
$options['min_age']=16;
}
}
return $options;
}
add_filter('agp_verify_age','agp_verify_age',1,2);
function agp_verify_age($show, $post_id){
if (is_product()){
global $post;
$product = wc_get_product( $post->ID );
$id = $product->get_id();
$postMeta = get_post_meta($id, 'Verkauf_ab', true);
if($postMeta == '18'){
$show=true;
}elseif($postMeta=='16'){
$show=true;
}
if($postMeta== 'none'){
$show=false;
}
return $show;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment