Ensure WooCommerce Subscriptions plugin functions exist

This commit is contained in:
Emili Castells Guasch 2023-08-16 11:24:34 +02:00
parent 895cc486d4
commit 26c9733181
5 changed files with 13 additions and 6 deletions

View file

@ -233,6 +233,10 @@ class SubscriptionModule implements ModuleInterface {
* @psalm-suppress MissingClosureParamType
*/
function( string $post_type, $post_or_order_object ) use ( $c ) {
if ( ! function_exists( 'wcs_get_subscription' ) ) {
return;
}
$order = ( $post_or_order_object instanceof WP_Post )
? wc_get_order( $post_or_order_object->ID )
: $post_or_order_object;