I am using a CRM-plugin and would love to be able to add the "Shop as customer"-button to that view as well, so that I do not have to click my way to the dashboard everytime. Is it possible for you to give me the code used to redirect us as a specific customer?
Hi,
I am using a CRM-plugin and would love to be able to add the "Shop as customer"-button to that view as well, so that I do not have to click my way to the dashboard everytime. Is it possible for you to give me the code used to redirect us as a specific customer?
Hi Mervin,
The plugin runs the following JavaScript code when the page is loaded:
It's not a simple redirect - the code calls an ajax function that needs to set cookies, check security, etc.
I suggest you to add the above as a JS code snippet ( https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/ )
You would need to replace '.salesking_shop_as_customer' with the class or id of your button.
The value of the button must also be equal to the user id of the customer you want to shop as.
(such as this html: <button value="123">Shop Customer</button>)
Hope this helps,
Kind regards,
Stefan