【发布时间】:2019-12-17 20:52:06
【问题描述】:
我的网站上有多个订阅产品,包括每月、每年和每周。
我正在运行此代码,该代码运行良好(将“月更改为 30 天”)但仅适用于具有“每月”的产品如何应用它来更改每周和每年的字符串?
谢谢
function wc_subscriptions_custom_price_string( $pricestring ) {
$newprice = str_replace( 'month', '30 days', $pricestring );
return $newprice;
}
add_filter( 'woocommerce_subscriptions_product_price_string', 'wc_subscriptions_custom_price_string' );
add_filter( 'woocommerce_subscription_price_string', 'wc_subscriptions_custom_price_string' );
【问题讨论】:
-
嗨@Imran!你在解决这个问题上的尝试是什么?你能发布你迄今为止尝试过的东西吗?你知道你想用什么替换什么字符串吗?谢谢!
标签: php wordpress woocommerce str-replace woocommerce-subscriptions