Developer Doc – Dokan Subscription

Dokan Multi Vendor Documentation

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.

Product/Post meta

The meta keys that are registered by Dokan Subscription add-on are described below.

  1. _no_of_product: The number of products allowed to create after buying that particular pack. This one provides numerical value.
  2. _pack_validity: The number of days till the pack expires. This one provides numerical value.
  3. _enable_recurring_payment: If the recurring system should be activated or not. This one provides the values as yes or no.
  4. _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.
  5. _subscription_period: This one is hard coded as days. This one contains a value if the subscription pack is not recurring.
  6. _subscription_length

User Meta

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:

  1. product_id:
  2. 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.
  3. product_order_id: The order number that was used to purchase the subscription.
  4. product_no_with_pack:
  5. product_pack_startdate: The date the subscription pack purchased. The validity is calculated based on this date.
  6. product_pack_enddate: The date when the subscription pack will be expiring.
  7. can_post_product: The capability to post product is controlled by this value. This one provides boolean values – 0 or 1
  8. _customer_recurring_subscription: This one mentions if the subscribed plan is recurring or not. This one provides true or false value.