@cali_green
To get the quantity of a WooCommerce subscription, you can use the following code snippet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// Get the subscription ID $subscription_id = 123; // Get the subscription object $subscription = wcs_get_subscription( $subscription_id ); // Check if the subscription is valid if ( $subscription ) { // Get the quantity of the subscription $subscription_quantity = $subscription->get_quantity(); // Output the quantity echo 'Quantity: ' . $subscription_quantity; } else { echo 'Invalid subscription ID'; } |
Replace 123
with the ID of the subscription you want to get the quantity of. This code snippet will output the quantity of the specified subscription.