Jump to content

Custom Content by User Group


Recommended Posts

I have a store where there are 3 different groups and I need to have custom content on the shipping page for each group. Is there a way to create different custom copy based off the users group they are in?

For example

Bob is in group 1

Sally is in group 2

Fred is in group 3


The custom content in the shipping page for group 1 needs to say

"There will be no expedited shipping."


The custom content in the shipping page for group 2 needs to say

"If you require expedited shipping please contact your manager."


The custom content in the shipping page for group 3 needs to say

"All shipments will be shipped out every Friday for Monday deliver."


Thanks for your help.

Link to comment
Share on other sites

  • 6 months later...

Did this ever get worked out?


If you could somehow grab the user group ID you could write some javascript to return different statements based on those values. I just can't think of how to grab the value.


Any thoughts?

Link to comment
Share on other sites

  • 2 months later...

So after mulling this over for awhile, I've come up with something of a hack. The biggest caveat is having access to an unused User External ID field. If your portal is using this field for an integration then you're probably out of luck. This method also uses MCC's variable field functionality.


Here's how to do it:


  1. Enter the group name into the unused External ID field for each user. Since each External ID must be unique, I appended the ID to the User Group name in Bulk Ops to achieve this.
  2. In the appropriate Custom Content box, enter the code below. This will return a string containing the user's group name. Note display is set to none so user won't see it.
    <span id="userGroup" style="display:none;">%%User.ExternalId%%</span>

  3. Below that, create each group's content as shown below. You can change the IDs to something more meaningful.
    <div id="group-1-note" style="display:none;">
       Group 1 Content Here.
    <div id="group-2-note" style="display:none;">
       Group 2 Content Here.
    <div id="default-note" style="display:none;">
       Default Content Here.

  4. Below that, enter the following script. Again, you're going to want to change the IDs and group names to fit your application. The script reads the content of the userGroup element and toggles on/off the display property for the appropriate content.
    <script type="text/javascript">
       var x = document.getElementById("userGroup").textContent;
       var y = x.indexOf("Group-1")
       var z = x.indexOf("Group-2")
       if (y >= 0) {
           document.getElementById("group-1-note").style.display = "inline";
       else if (z >= 0){
           document.getElementById("group-2-note").style.display = "inline";
       else {
           document.getElementById("default-note").style.display = "inline";

  5. You can test by impersonating users from different groups in your store.


Admittedly, this could get pretty complicated depending on how many groups you have to serve up custom content for. If anyone can figure out a more efficient way, please post it.


If there was a way to grab a user's group ID or a variable for one of the new generic fields, then you wouldn't need the external ID.


Thanks and good luck!

Edited by johnw
Originally did not account for unique External IDs.
Link to comment
Share on other sites

  • 4 weeks later...
  • Create New...