php – Capturing variable after slash in domain

Question

I’m developing an ecommerce website with WordPress / Shopify API. I’d like to be able to capture discount codes through the URL.

So if the discount code was code40, I’d like the enduser to be able to go to website.com/code40 and have that discount code automatically feed into the checkout. I’ve tried a few different methods, but I’m struggling to get a working solution. I have a good idea on how I’m going to feed the variable into checkout, but I’m struggling with capturing the data after the URL. Is this something I should do through HTACCESS/PHP or maybe JavaScript and a cookie? Any suggestions?

0
user3618739 1 week 2021-04-07T09:32:40-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse