Skip to content

Latest commit

 

History

History
87 lines (60 loc) · 3.15 KB

File metadata and controls

87 lines (60 loc) · 3.15 KB

Pronamic period information for Woo Subscriptions

This “Woo Subscriptions” add-on ensures that a period is saved with each subscription order. The “Woo Subscriptions” plugin itself does not store the subscription period in an order. Without this add-on, it is not clear to webshop owners and customers for what period the subscription order and associated payment was.

Table of contents

Order item meta

Period is stored in the following order item meta:

Key Description.
_pronamic_start_date Period start date.
_pronamic_end_date Period end date.

Usage

$orders = \wc_get_orders(
	[
		'status'  => [
			'wc-completed',
			'wc-refunded',
		],
		'type'    => 'shop_order',
		'limit'   => 10,
		'orderby' => 'date',
		'order'   => 'ASC',
	]
);

foreach ( $orders as $order ) {
	echo 'Order: ', $order->get_id(), PHP_EOL;

	foreach ( $order->get_items() as $item ) {
		echo '- Start date: ', $item->get_meta( '_pronamic_start_date' ), PHP_EOL;
		echo '- End date: ', $item->get_meta( '_pronamic_end_date' ), PHP_EOL;
	}
}

Screenshots

WordPress admin dashboard

Screenshot of the WooCommerce order detail page in the WordPress admin dashboard with the period visible per item.

Screenshot of the WooCommerce order detail page in the WordPress admin dashboard with the period visible per item.

WooCommerce checkout page

Screenshot of the WooCommerce checkout page where a customer manually renews a subscription (early) and the period is visible.

Screenshot of the WooCommerce checkout page where a customer manually renews a subscription (early) and the period is visible.

Tested flows

  1. Frontend: My account → My Subscription → Actions → Renew now
  2. Background: Automatic renewal order via the Action Scheduler library.
  3. Backend: WooCommerce → Subscriptions → Edit Subscription → Order actions → Create pending renewal order

Accounting programs

Certain accounting programs offer the option to define a period for invoice lines. In this way, an accounting program can automatically distribute the amounts over a period. This can be used for “Prepaid expenses” and “Deferred revenue” on the balance sheet.

Moneybird

Moneybird is an accounting program with the option to set a period per invoice line:

This plugin can make it easier to connect WooCommerce Subscriptions orders to your accounting in Moneybird.

Links