No announcement yet.

Code to check customer group logged into on item page

  • Filter
  • Time
  • Show
Clear All
new posts

  • Code to check customer group logged into on item page

    Does anyone have the code that I can use to check the logged in customer group on the item page? I want to try and hide the add to cart and qty fields if not logged in as a specific customer group. I am currently using the feature within 3Dcart to hide items using price levels from customer groups and that works by clocking the entire item. However I want to show the item and the details, but hide only the add to cart and qty fields on the item page if not logged into a specific customer group.

  • #2
    I'm looking for something similar so I can add Google Analytics code to differentiate customer groups on GA reports. Please keep me in mind if you find what you're looking for.
    - Dean P. e-commerce and small business consulting


    • #3
      I have not found a way to determine Customer Group per se, however, you can determine Price Level
      You can assign a customer group to a price level

      For example: 'Commercial2' is assigned 'Price Level 2'

      So this might work, might not, just depends on your needs

      In the Frame.html page, add a hidden element near the top to read the PriceLevel value, something like this
      <span class="hidden" id="priceLvl">[price_level]</span>

      [price_level] will return teh numeric value of the Price Level of the user

      Then in your script file, you can check for it and take the action needed
      //if Price Level == ' ', then No Price Level i.e. Retail not Commercial
      if($('#priceLvl').text() != ''){
      do something;
      } else {
      do something else

      If multiple PLs you could check the value to take action on a specific level, etc.
      e.g. if($('#priceLvl').text() == '2'){ }
      Last edited by lazarusjl; 08-07-2018, 04:52 PM.


      • #4
        lazarusjl, thank you. That worked like a charm. I was able to check the price level variable and hide what I wanted to. I had to add the hidden variable code to the frame.html file and then I added my javascript right to the item page. Good to go, thank you for the guidance.


        • #5
          Diamond Web Design, glad it helped!