woocommerce offtopic - How to remove recurring totals information for a particular subscription product?

Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

I have a subscription product in which I have customized checkout page for this particular product. I want to remove "Recurring Totals" row from checkout and cart page.

Here is my code:

function cart_subtotal_func_unset( $total ) {
    print_r($total);
    unset($totals['cart_subtotal']);
    return $totals;
}
add_filter('woocommerce_cart_item_subtotal', 'cart_subtotal_func_unset', 10, 2);

And here is my screenshot for checkout page.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

I have a subscription product in which I have customized checkout page for this particular product. I want to remove "Recurring Totals" row from checkout and cart page.

Here is my code:

function cart_subtotal_func_unset( $total ) {
    print_r($total);
    unset($totals['cart_subtotal']);
    return $totals;
}
add_filter('woocommerce_cart_item_subtotal', 'cart_subtotal_func_unset', 10, 2);

And here is my screenshot for checkout page.

Share Improve this question asked Apr 30, 2019 at 5:21 Arshad HussainArshad Hussain 2101 gold badge5 silver badges17 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 4

Try filtering the hook woocommerce_cart_calculate_fees.

Use this code. it might work for you.

add_filter( 'woocommerce_cart_calculate_fees', 'add_recurring_postage_fees', 10, 1 );

function add_recurring_postage_fees( $cart ) {
    if ( ! empty( $cart->recurring_cart_key ) ) {
        remove_action( 'woocommerce_cart_totals_after_order_total', array( 'WC_Subscriptions_Cart', 'display_recurring_totals' ), 10 );
        remove_action( 'woocommerce_review_order_after_order_total', array( 'WC_Subscriptions_Cart', 'display_recurring_totals' ), 10 );
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745539489a4632061.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信