Shopify / js-buy-sdk

The JS Buy SDK is a lightweight library that allows you to build ecommerce into any website. It is based on Shopify's API and provides the ability to retrieve products and collections from your shop, add products to a cart, and checkout.
https://shopify.github.io/js-buy-sdk
MIT License
989 stars 261 forks source link

Referral (ref) string cannot be applied #777

Open nemanja-sljivic opened 4 years ago

nemanja-sljivic commented 4 years ago

Please complete the checklist before filing an issue:

None of the above? Create an issue. Be sure to include all the necessary information for us to understand and reproduce the problem:

Bug details

Describe the bug We have an affiliate program in our application. Affiliates have their referral string, and coupon code. We are trying to add at some point a referral string (ref=XXXXXX) for our customers. Shopping is done and is users add referral string trough mobile app. Only way we could add it was with 'addDiscount' that adds coupon code from our affiliate, and it works just the first time. When we try to add it again, cart references other affiliate or none.

To Reproduce Steps to reproduce the behaviour: if (couponInfo) await client.checkout.addDiscount(id, couponInfo.discount_code); This adds referral to the order but just the first time the coupon is available to be used. We want to attach referral on every user order.

Expected behavior Users orders always have attached referral from their affiliate on their orders.

Environment (please complete the following information):

Bug Report Checklist

shawngrona commented 3 years ago

@shopify-services @shopify-dep Can someone give some guidance on the above? I'm not sure who to mention here to get some help on this question.

How do we provide ref for the use case of attributing affiliates via the shopify buy sdk?