If you use the Subscriptions module in the VTEX Admin, we recommend creating a subscription plan through this module. For more information, see the article Creating a subscription plan.
Subscriptions is the VTEX solution that allows merchants to sell to subscribing customers on a recurring, automatic basis based on a specified frequency.
There are two ways your store's products can be purchased via subscription:
- Creating subscription plans via the Subscriptions module.
- Creating subscription attachments via the Catalog module.
This article explains how to create subscription attachments via the Catalog, which is recommended when your store does not use the Subscriptions (Beta) module.
It's important to understand the use of the term attachment in the context of subscriptions:Attachment: An optional, no-cost customization of the SKU that allows the merchant to add additional information to an item.Subscription attachment: A specific type of attachment that allows creating subscriptions for an SKU. Customers can subscribe to receive the SKU periodically when it is associated with a subscription attachment.SKU subscription with attachment: When a customer creates a subscription from an order containing a SKU with an attachment, the attachment from the original order will only be kept in future subscription orders if the merchant enables this setting. This can be done only via API using the Edit subscriptions settings endpoint. Learn more in How to keep attachments from original orders in subscriptions.
Catalog subscription attachment
The subscription attachment is used to configure the subscription feature for the SKU it's associated with. This type of attachment contains the subscription frequency and cycle date settings.
To create a subscription attachment from the Catalog, you must do the following:
- Create the subscription attachment
- Configure the subscription frequency and cycle date
- Associate the SKU with the subscription attachment
1. Creating the subscription attachment
Follow the steps below to create a subscription attachment:
- In the VTEX Admin, go to Catalog > Custom Fields, or type Custom Fields in the search bar at the top of the page.
- In the Services and SKUs tab, click
New Attachment
. - In the Name field, enter a value in the format
vtex.subscription.{suffix}
, and replace{suffix}
with the name you want to use to differentiate this subscription, as in the following examples:vtex.subscription.plan1
vtex.subscription.test
- In the Attachment required field, leave the checkbox unchecked.
Make sure the Attachment required checkbox is unchecked. If it is checked, the Subscriptions system will try to send an order with a subscription for an item that already has a required attachment (the subscription attachment), which will generate an error in the system. Therefore, if the Attachment required field was checked by mistake, uncheck it and ask the customer to place the order again.
- In the Status field, select the checkbox
Enable/Disable the attachment
. - Click
Save
.
2. Configuring the frequency and date of the subscription cycle
After creating the subscription attachment, you must configure the frequency and date of the subscription cycle. The frequency is the periodicity of the subscription. This value is displayed for your customers to choose when they create the subscription and can be set to daily, weekly, monthly, or yearly, depending on your business strategy.
The subscription cycle date corresponds to the day on which the order will be repeated each subscription cycle. For example, if a customer creates a subscription for cat food on the 15th of each month, the 15th is the cycle date, and the subscription frequency is monthly.
To configure the subscription frequencies and cycle dates you want to offer in your store, follow the steps below:
- In the VTEX Admin, go to Catalog > Custom Fields, or type Custom Fields in the search bar at the top of the page.
- In the Services and SKUs tab, in the row corresponding to the attachment you created previously, click
Edit
. - In the Key name field, enter the fixed value
vtex.subscription.key.frequency
, which corresponds to the frequency. - In the Permitted values field, set the desired values for the subscription frequency (following the guidelines in the table below).
- Click
Add New
. - In the Key name field, enter the fixed value
vtex.subscription.key.purchaseday
, which corresponds to the date of the subscription cycle. - In the Permitted values field, set the desired values for the cycle date (following the guidelines in the table below).
If no value is entered in the Permitted values field for
vtex.subscription.key.purchaseday
, the subscription cycle date will be the same day of the week (for weekly frequency) or day of the month (for monthly frequency) as the original order.
You do not need to complete the Maximum number of characters field.
- Click
Save
.
Key name | Permitted values |
---|---|
vtex.subscription.key.frequency | The permitted values are a combination of a number from 1 to 9 + space + any of the following:day : Daily orders. Example: 5 day .week : Weekly orders. Example: 4 week .month : Monthly orders. Example: 3 month .year : Yearly orders. Example: 2 year . |
To offer multiple frequency options, separate the values with a comma and do not include a space after the comma.Example: To offer both a monthly and a weekly subscription option, enter 1month,1week
.
|
| vtex.subscription.key.purchaseday
| Weekly frequency
The permitted values for the weekly subscription cycle date range from 0 to 6, corresponding to the days of the week:0
: Sunday1
: Monday2
: Tuesday3
: Wednesday4
: Thursday5
: Friday6
: Saturday
To offer more than one day for the cycle with a weekly frequency, separate the values with a comma.Example: A weekly subscription with a cycle date on Sundays, Wednesdays, and Fridays would be written as 0,3,5
.
Monthly frequency
The permitted values range from 1
to 28
and correspond to the days of the month, where 1
is the first day of the month, 2
is the second, and so on, up to 28
, which is the twenty-eighth day of the month.
If you use more than one number, separate them with a comma and do not include a space after the comma.Example: A monthly subscription with a cycle date on the first and last days would be written as 1,28
.
|
The following images provide examples of how to complete the fields in the VTEX Admin:
-
Example of monthly frequency: The image shows a monthly subscription where orders can be placed on the 1st, 15th, or 28th of each month.
-
Example of a frequency every 3 weeks: The image shows a subscription that generates new orders every 3 weeks, with purchases occurring on Sundays, Tuesdays, or Saturdays.
3. Associating a SKU with the subscription attachment
Lastly, to create a subscription attachment in the Catalog, associate the subscription attachment with the desired SKUs. To do so, follow the steps below:
- In the VTEX Admin, go to Catalog > All Products, or type All Products in the search bar at the top of the page.
- In the SKU column, click the SKU name you wish to associate with the subscription attachment.
- In the Advanced Settings tab, find the Attachments field and check the subscription attachment checkbox.
- Click
Save
.
After that, customers will be able to create subscriptions in your store to automatically purchase the SKU associated with the subscription attachment on a recurring basis.