Restrict access to products and edit or add customer data (like tags) in Shopify using your own private API.
I ran into a an interesting problem designing a special Shopify purchasing experience for a client. Basically, I needed to have a front-end “terms acceptance” page for wholesale buyers, that would in turn give them access to restricted products on the site.
To solve this, I put together a solution using a PHP based private app.
The main action that is going to occur here is that we are going to pass the customer ID in the URL and use that customer ID to make a "Put" request on the Shopify API to update the customer's "Tags".
Create a private app in your Shopify admin
1. Go to your admin, then go to Apps in the side menu. At the top of that page, you will see a button for “Private Apps”.
2. On the next screen, go to “Create Private App”
3. In the app settings, set permissions to Read and Write
4. Save your app, then copy your API Key & Password over to the shopify-api.php file you made earlier.
Create your front-end user experience.
You need to use Shopify to generate the customer ID using Shopify Liquid and send user to your-url/shopify-api.php?id=YOUR-CUSTOMER-ID.
The shopify-api.php file you made earlier will pull the ID and update the customer tag.
For example, you could create a liquid “if” statement that if a customer has a certain tag, a popup should be triggered.
The “I accept” button would be a link taking you to where you have the shopify-api.php file hosted. your-url/shopify-api.php?id=YOUR-CUSTOMER-ID
This could easily be implemented in a Node.JS based application as well (instead of PHP).
Create redirect system for Shopify
Redirection will effectively help you restrict certain areas of your site. You can redirect visitors based of their customer tag, which you've modified using the shopify-api. You can view a guide to restricting content and creating redirects here.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
âś“ Live Streamingâś“ Interactive Chatâś“ Private Showsâś“ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming
Custom Bootstrap/Wordpress design utilizing Advanced Custom Fields for enhanced admin editors. Also includes enhanced Woocommerce integration and a custom wholesale linesheet generator.
Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
âś“ Live Streamingâś“ Interactive Chatâś“ Private Showsâś“ HD Quality
Anya is LIVE right now
FREE
Free to watch • No registration required • HD streaming