• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Don't show recurring price for WooCommerce subscriptions worth 0$

phpwordpresswoocommercehook-woocommercewoocommerce-subscriptions


PHP Snippet 1:

add_filter('woocommerce_subscriptions_product_price_string', 'alter_woocommerce_subscriptions_product_price_string', 10, 3);

function alter_woocommerce_subscriptions_product_price_string($subscription_string, $product, $include) {
    if ($include['sign_up_fee']) {
        if (strpos($subscription_string, '0.00') !== false) {
            $subscription_string = explode('and a', $subscription_string);
            $subscription_string = $subscription_string[1];
        }
    }
    return $subscription_string;
}

Related Snippets

Using array_intersect on a multi-dimensional array

Multiple order by in WooCommerce

Mobile browsers are adding .html to filename on download

How can I make a full text index of the column?

Changing font color in javascript

Fetch files from next cloud storage and display in Laravel website

Laravel csrf token mismatch for ajax POST Request

Yoast SEO (WordPress Plugin) - Get plugin generated data manually

"There is no active transaction" when refreshing database in Laravel 8.0 test

Coinpayments create_transaction "ERROR: Invalid command!"

woocommerce get_order_report_data to show order_item_id

PHP cURL (SSL certificate problem: self signed certificate in certificate chain)

Could not decode a text frame as UTF-8.

Override default Auth routes in Laravel 7

Session timeout in Yii2

About Contact Privacy policy Terms and conditions