I am looking to programmatically add a coupon code to a customers account so next time they come to the site and login to there account there will already be a cart price rule automatically applied to any cart they have or start.

I thought if i added the cart price rule unique id and the unique customer id to the salesrule_customer table it would work but it did not.

Does anyway one of a database table that i would need to add info to in order to get this to work.

The use case would be if someone types in there mobile phone number into a popup to get a discount code I would then query a customer database to see if we have that mobile number associated with a registered customer and if so auto apply the coupon code that we would be giving to them to use.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.