Developer Doc – Dokan Subscription
Dokan Subscription add-on is used to charge the vendors before uploading their products into the site and keeping the products online for a predefined time.
Dokan Subscription add-on works on two parts. The subscription packs are just like regular WooCommerce products, of course, a custom product type. But from a developers perspective, it is just a custom post type containing extra meta keys.
The meta keys that are registered by Dokan Subscription add-on are described below.
- _no_of_product: The number of products allowed to create after buying that particular pack. This one provides numerical value.
- _pack_validity: The number of days till the pack expires. This one provides numerical value.
- _enable_recurring_payment: If the recurring system should be activated or not. This one provides the values as yes or no.
- _subscription_period_interval: After how many days the pack will expire and the access to create a product will be revoked. This one provides numerical value.
- _subscription_period: This one is hard coded as days. This one contains a value if the subscription pack is not recurring.
We are placing 8 different user meta keys and values to keep track of the subscription and related data. The meta keys are defined below:
- product_package_id: This meta key holds the subscription pack id. Thus, this key holds the most important data. If you want to provide the vendors extra features depending on the packs, this is the key you should use.
- product_order_id: The order number that was used to purchase the subscription.
- product_pack_startdate: The date the subscription pack purchased. The validity is calculated based on this date.
- product_pack_enddate: The date when the subscription pack will be expiring.
- can_post_product: The capability to post product is controlled by this value. This one provides boolean values – 0 or 1
- _customer_recurring_subscription: This one mentions if the subscribed plan is recurring or not. This one provides