Public image generation can be effectively limited, but this may not suit all situations. That’s why you can now offer your users the option to purchase credits to use image generators.
Setting up a credit balance is simple. You just need to add a WooCommerce product (e.g., credit packs: 10 – 50 – 150). This works without any other WooCommerce extensions.
When a user purchases a number of credits, they have a credit balance on their account to use the generators. When they run out of credits, a link to your product is suggested so they can purchase more.
Credits are only credited once when the order is completed.
Users can accumulate credit purchases, and you just need to monitor your credit API.
What you need :
- Artist Image Generator plugin
- WooCommerce plugin
Step 1. Configure a new product in WooCommerce
This will be the product where customers will buy credits from. In order to work, you need to configure some fields this way :
- Product Type: Variable Product
- Sold Individually: checked (yes)
- Attributes > Add new attribute: name = credits, value = your packs values e.g. 10|50|100|1000
- On this attribute: Visible On Product Page: unchecked (no)
- On this attribute : Enable Variations: checked (yes)
- Variations > Create variations from Attributes
- For each variation : Variable Is Virtual: checked (yes)
Fill others fields like price, description, title the way you want. Save.
Step 2. Link the product to Artist Image Generator
- Get the ID of your new WC Product : Product > All the products > ID: {the ID}
- Copy / Paste inside Media > Artist Image Generator > Settings > WC_PRODUCT field
- Save.
That’s all!
To disable the functionnality
- Leave blank WC_PRODUCT field