• 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

Adding custom body class to the custom archive pages

Whats the point of running Laravel with the command 'php artisan serve'?

jQuery Ajax Post with data

Additional price based on cart item count in WooCommerce

Applying programmatically a coupon to an Order in WooCommerce3

Detect a fetch request in PHP

add " ? " in url via htaccess RewriteRule

Execute only one time and then wait set period of time before executing again

Center point of multiple gps coordinates with php

Unable to create lockable file - Laravel 8 & PHP 8

Group rows by column and sum another column within groups [duplicate]

WooCommerce - unset "<product> removed notice…" on cart page

could not find driver Debian SQL Server PHP

What will the best solution for this multiple optional filter?

Google Calendar API batch request PHP

About Contact Privacy policy Terms and conditions