我在 content-product.php 页面上的 wordpress 上有类似的问题
这就是我要给出的内容......遗憾的是没有工作......知道我可以在那里使用什么来检查我的成员是否得到了他们的计划并显示价格?
第一个价格是没有折扣的。第二个价格是vip折扣。
<?php
if (wc_memberships_is_user_active_member($user_id, 'pack-vip') {
echo $price_val, $symbol
} else {
echo $price_val - $vip_discount, $symbol
}
所以我尝试了一些替代方案来回声......
//print / printf /printr doesn't work
//return (doesn't work)
//echo (doesn't work)
//empty before $price_val (doesn't work)
//What i want to deliver is something like
//echo $price_val - $vip_discount, $symbol //
//Without if or else, works fine but only for
//users without the pack VIP.
//For users with pack VIP, it reduces the prices
//again on it
//Solution, need to split with if else in content-
//product.php to verify
//If user is active member of 'pack-vip' (slug)
//Display the price without $vip_discount
?>