Remove British Forces from Multi-Address Modal
In this tutorial, we’ll guide you through removing “British Forces” from the multi-address modal.
Step 1: Duplicate Your Live Theme
Always work on a duplicated development theme to ensure your live store remains unaffected by changes.
Step 2: Create and Upload the Snippet
- Navigate to the Assets folder of your theme.
- Create a new JavaScript file named
giftship-british-forces.js
. - Copy and paste the following code into the file:
class ClassWatcher { constructor(targetNode, classToWatch, classAddedCallback, classRemovedCallback) { this.targetNode = targetNode this.classToWatch = classToWatch this.classAddedCallback = classAddedCallback this.classRemovedCallback = classRemovedCallback this.observer = null this.lastClassState = targetNode.classList.contains(this.classToWatch) this.init() } init() { this.observer = new MutationObserver(this.mutationCallback) this.observe() } observe() { this.observer.observe(this.targetNode, { attributes: true }) } disconnect() { this.observer.disconnect() } mutationCallback = mutationsList => { for(let mutation of mutationsList) { if (mutation.type === 'attributes' && mutation.attributeName === 'class') { let currentClassState = mutation.target.classList.contains(this.classToWatch) if(this.lastClassState !== currentClassState) { this.lastClassState = currentClassState if(currentClassState) { this.classAddedCallback() } else { this.classRemovedCallback() } } } } } } (function() { var removeOpts = function() { setTimeout(function() { var provinceEl = document.querySelector('#gsNewProvince'); var optionEls = provinceEl.querySelectorAll('option'); //console.log("optionEls", optionEls); optionEls.forEach(function(el) { console.log("el.value", el.value); if (el.value === "British Forces") { el.remove(); } }); }, 300); }; document.querySelector('#gsNewCountry').addEventListener('change', function(e) { //console.log("change", e); removeOpts(); }); let classWatcher = new ClassWatcher(document.querySelector('.gs__a-modal'), 'gs__m-open', removeOpts, function() { }); removeOpts(); })();
Step 3: Edit theme.liquid to Include the Snippet
- Open theme.liquid in your theme editor.
- Scroll to the bottom of the file, just above the closing
</body>
tag. - Paste the following code:
{% if request.path contains '/a/gs/cart/' %} <script src="{{ 'giftship-british-forces.js' | asset_url }}"></script> {% endif %}
Step 4: Remove Additional Provinces (e.g., Northern Ireland)
if (el.value === "British Forces" || el.value === "Northern Ireland") { el.remove(); }
Can't find the answer in our documentation?
Contact Support Remove British Forces from Multi-Address Modal
How to Add Custom Scripts to Multiship
Troubleshooting Missing Shipping Rates with Multiple Shipping
Edit Gift Messages etc on Multiship and Cart Page in Giftship
Fulfilling Multiple Shipping Address Orders
Viewing Reports with Multiple Shipping Address Orders
Discount Codes for Multiple Shipping Address Orders
Tax Calculation for Multi-Address Checkouts in the United States
Conditionally Hide Giftship Options Based on Your Carts Contents
Sending non-physical products to multiple recipients
Using Tax Overrides for Multiple Address Checkouts
Enable Order Notes for Shipping to Multiple Addresses
Making the Multiple Shipping Address Checkout Cart the Default
Selling Digital Gift Cards with the Multiple Shipping Address Process
Shopify Plus: Configuring Avalara to Honour Shopify’s Tax Settings