Created
June 16, 2017 16:14
-
-
Save anonymous/237ca705fbe970ba06b86a22d3fe1d90 to your computer and use it in GitHub Desktop.
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('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