【发布时间】:2020-12-07 10:51:50
【问题描述】:
我正在使用以下代码专门针对基于订阅的产品。
// Display total amount on place order button
add_filter('woocommerce_order_button_text', 'subscriptions_custom_checkout_submit_button_text' );
function subscriptions_custom_checkout_submit_button_text( $order_button_text ) {
if ( WC_Subscriptions_Cart::cart_contains_subscription() ) {
$cart_total = WC()->cart->total;
return __('Pay $' . $cart_total, 'woocommerce');
} else {
// You can change it here for other products types in cart
# $order_button_text = __( 'Something here', 'woocommerce-subscriptions' );
}
return $order_button_text;
}
现在,我想在产品价格之后显示订阅期,例如,如果有人购买包月订阅产品,按钮应显示为(支付 20 美元/月)。
【问题讨论】:
标签: php wordpress woocommerce checkout woocommerce-subscriptions