Custom Discounts API Version 2

IMPORTANT: THIS IS THE VERSION 2 OF THIS FEATURE, AND IT IS NOT COMPATIBLE WITH VERSION 1, IN THIS VERSION SECURITY ISSUES WERE ADDRESSED. WE DO RECOMMEND ANYONE USING CUSTOM DISCOUNTS TO USE THIS VERSION, THE VERSION CAN BE CHANGED IN THE APP SETTINGS.


The Revy Unlimited Bundles app has a feature via API that allows adding extra discounts to the Bundle Discount, this feature was created due to the Shopify Discount limitation which allows applying just one discount to an order, using this feature you can stack more discounts to the Bundle Discount.

Basically, this feature adds more discounts to the Bundle Discount, here is an example:

  1. The customer has a Bundle with product A and B and this Bundle have a discount of $5 OFF; 
  2. Our app will generate a Bundle Discount with the value of $5; 
  3. Now, let's say the customer adds a third product, the C product.
  4. Merchant wants to add a discount on the product C of $3; 
  5. Using the Bundle API he can use this command to add the discount:
window.RevyBundle.api.addCustomDiscount({ 
	code: "DISCOUNT_CODE"
})

You can create the custom discounts opening the Revy Bundles App and going to Settings > Custom Discounts > Version 2. There you will create the custom discounts that can be applied using the command above.

Conditions

There are conditions that need to meet in order for the Custom Discount apply correctly:

  • Make sure you select the "Draft Order" discount type on your Bundle App settings
  • Cart matches a Bundle (if cart not matches a Bundle it will not exist a Bundle Discount that the Custom Discount can be applied to)
  • A Custom Discount will only apply to variants that not belongs to matched Bundles, to avoid 1 variant to be discounted multiple times, the variant can only be discounted once(or by the Bundle Discount or by the Custom Discount)
  • The field Coupon Code of the custom discount must be unique, it will be the identifier to apply the discount

Creating a Custom Discount

Open the Revy Bundle App and go to Settings > Custom Discounts > Version 2 > New, click the button and the form will show with the custom discount fields:

Those are the fields:

Coupon Code: Unique identifier of the Custom Discount, can be a number or a string, just keep it small. 

Variant Id: Variant id of the product that will be discounted

Quantity: Quantity of the variant that the Discount will be applied

Discount Type: The possible values are "percentage", "fixed_amount" and "free_gift" (reduced 100% of the variant price)

Discount Value: The value of the discount, a number, don't add a currency symbol, valid examples: "5", "10", "7"

Discount Title: A small text describing the discount, it will show on the line item discount description, keep it small, 2 or 3 words at maximum, or keep it empty

After create the custom discount you are ready to add it to your cart. See how below.

Adding a Custom Discount

The Custom Discount API is quite simple, it uses our Javascript API:

window.RevyBundle.api.addCustomDiscount(Bundle Discounts..)

The complete command to apply the custom discount is:

window.RevyBundle.api.addCustomDiscount({ 	
	id: "christmas_20_percent", 	
 })

Removing a Custom Discount

To remove a custom discount just use:

window.RevyBundle.api.removeCustomDiscount(DISCOUNT_ID)

Retrieve all Custom Discounts

To remove a custom discount just use:

window.RevyBundle.api.getCustomDiscounts()

Remove all Custom Discounts

To remove a custom discount just use:

window.RevyBundle.api.clearCustomDiscounts()

Please let us know if you need any help setting up the Custom Discounts API, we will be happy to answer you, just ping us at [email protected] ;)

Still need help? Contact Us Contact Us