I am developing the e-commerce website, I want to display the different price for loggedin users and different for loggedout users. Can anyone please let me know how can I do this in woocommerce.
1条回答 默认 最新
- douhanzhen8927 2016-01-16 04:11关注
You will need some custom code. This gets placed in your theme
functions.php
file or custom plugin code.function custom_get_price( $price, $product ) { $discount = 0.5; if( is_user_logged_in() ) $price = $price * $discount; return $price; } add_filter( 'woocommerce_get_price', 'custom_get_price',10,2);
This code hooks into the WooCommerce
get_price()
function in theabstract-wc-product.php
file.Some resources on adding custom code to WordPress
解决 无用评论 打赏 举报
悬赏问题
- ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
- ¥15 IAR程序莫名变量多重定义
- ¥15 (标签-UDP|关键词-client)
- ¥15 关于库卡officelite无法与虚拟机通讯的问题
- ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
- ¥15 目标检测项目无法读取视频
- ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
- ¥100 求采集电商背景音乐的方法
- ¥15 数学建模竞赛求指导帮助
- ¥15 STM32控制MAX7219问题求解答