Hide WooCommerce Subscription Details for Free Products

Recommendation

Learn why I switched to WPCodeBox for managing code snippets for myself and for my clients.

Instructions

Snippet Type: JavaScript

  1. Copy the snippet.
  2. Add the snippet using WPCodeBox.
  3. Follow any customization notes provided.
  4. Save the snippet.
  5. Enable the snippet.
  6. Test.

Snippet

If you use WooCoomerce Subscriptions, it may append /day, /month, etc., to the price. This snippet uses the opacity setting to make that text transparent.

				
					// HIDE SUBSCRIPTION DETAILS FOR FREE PACKAGES
jQuery(document).ready(function($) {
    $('span:contains("FREE")').siblings('.subscription-details').css('opacity', '0');
});