Skip to content

Instantly share code, notes, and snippets.

@wpextend
wpextend / functions.php
Created November 10, 2021 20:13
Minimum Periods for WooCommerce Subscriptions - Show cancellation notice on my-account page
<?php
function mpws_show_minimum_term_notice( $subscription ) {
$mpws_get_global_cancel_notice = get_option( 'mpws_allow_cancelling', 'yes' );
$mpws_get_global_min_periods_notice = get_option( 'mpws_allow_cancelling_periods', '0' );
if ( 'yes' === $mpws_get_global_cancel_notice ) {
foreach ( $subscription->get_items() as $item ) {
@wpextend
wpextend / minimum-periods-show-account.php
Last active January 30, 2022 13:03
Minimum Periods for WooCommerce Subscriptions - Show minimum terms on My Account page
<?php
function mpws_show_minimum_term( $subscription ) {
$mpws_get_global_cancel = get_option( 'mpws_allow_cancelling', 'yes' );
$mpws_get_global_min_periods = get_option( 'mpws_allow_cancelling_periods', '0' );
if ( 'yes' === $mpws_get_global_cancel ) {
foreach ( $subscription->get_items() as $item ) {
@wpextend
wpextend / minimum-periods-show-paid.php
Last active February 18, 2021 21:31
Minimum Periods for WooCommerce Subscriptions - My Account Page - Show Paid Terms
<?php
function mpws_show_paid_terms( $subscription ) {
$mpws_get_global_cancel = get_option( 'mpws_allow_cancelling', 'yes' );
$mpws_get_global_min_periods = get_option( 'mpws_allow_cancelling_periods', '0' );
$mpws_get_paid_count = $subscription->get_payment_count();
if ( 'yes' === $mpws_get_global_cancel ) {
foreach ( $subscription->get_items() as $item ) {