Remove Name Attributes from Gift Messages 🏷️

Name attributes specify the name of particular html elements. In the case of gift messages obtained through Giftship, your customer will have filled in fields with name attributes such as ‘To:‘, ‘From:‘, and ‘Message:‘.

For example, here are how the To and From attributes would look on an order.

If you would like to remove these from being included in the automated printing of Gift Messages on packing slips, etc. removing the name attribute value is the best way to do this. (This is an issue that often comes up with the automated printing of templates in 3PL’s such as Shipstation).

Go to Online Store –> Themes –> Your Theme –> theme.liquid, and insert the following code above the closing </body> tag.

To remove the ‘gift:Yes’ attribute, use this code:

    <script>
  	
      /**	
       * This is called every time Giftship loads
       */
      var GsLoaded = function() {
        
        // Remove the name attribute from the checkbox.
        Gs.$('.gs__gift-checkbox').removeAttr('name');
        
      };
      
  
    </script>

To remove attribute elements of the message sections, edit this code to target what you need to:

    <script>

    var GsLoaded = function() {
      
      Gs.$('#to_message').attr('name', 'note');
      
    };

    var GsLoaded = function() {
      
      Gs.$('#from_message').attr('name', 'note');
      
    };
    
    var GsLoaded = function() {
      
      Gs.$('#gsMessage').attr('name', 'note');
      
    };
    
  </script>

Can't find the answer in our documentation?
Contact Support