App installation and uninstallation is completely automated for the default features. If interested in using the optional features, the following steps may be necessary to add the needed code to your store’s theme files. If the optional features have been used and the app is being uninstalled, then the relevant code will need to manually removed.


Order details page (optional)

When installed, customers with store accounts will have the ability to update their shipping address for eligible orders from the order details page after signing in. Follow the steps below to install the code for this feature on your store's theme.


Copy the following code snippet to your clipboard:


{% if shop.metafields.crwdctrlupshipadd.enabled == 1 %}

          {% if order.fulfillment_status == 'unfulfilled' or order.fulfillment_status == 'partial' %}

          <p class="ccrelocate"><button type="button" onclick="ccUpdateAddress()" class="btn">Update shipping address</button></p>

          {% endif %}

          <script>

          function ccUpdateAddress() {

              sessionStorage.setItem('ccr_redirect', '{{order.customer_url}}');

              window.location = '{{shop.secure_url}}/apps/ccrelocate/?order={{order.id}}';

          }

          </script>

      {% endif %}



Paste the snippet in the theme file for templates/customers/order.liquid where you want the ‘change address’ button to appear. Usually this is just below the {{ order.shipping_address | format_address }} tag, the code may look something like this:


      {{ order.shipping_address | format_address }}

    {% if shop.metafields.crwdctrlupshipadd.enabled == 1 %}

      {% if order.fulfillment_status == 'unfulfilled' or order.fulfillment_status == 'partial' %}

      <p class="ccrelocate"><button type="button" onclick="ccUpdateAddress()" class="btn">Update shipping address</button></p>

      {% endif %}

      <script>

        function ccUpdateAddress() {

          sessionStorage.setItem('ccr_redirect', '{{order.customer_url}}');

          window.location = '{{shop.secure_url}}/apps/ccrelocate/?order={{order.id}}';

        }

      </script>

    {% endif %}



Once added, save your theme.



Order confirmation email (optional)

When installed, an ‘update address’ button will be visible in order confirmation emails. Follow the steps below to install the code for this feature on your store's theme.


1) Copy the following code snippet to your clipboard:


                  {% if shop.metafields.crwdctrlupshipadd.enabled == 1 %}

                  <p class="button__cell ccupdaddr"><a href="{{ shop.url }}/apps/ccrelocate/?order={{id}}" class="button__text">Update Address</a></p>

                  {% endif %}


Paste the snippet in the stores Order Confirmation email template where you want the ‘update address’ button to appear. Usually this is just below the {{ shipping_address | format_address }} tag, the code may look something like this:


                  {{ shipping_address | format_address }} 

                  {% if shop.metafields.crwdctrlupshipadd.enabled == 1 %}

                  <p class="button__cell ccupdaddr"><a href="{{ shop.url }}/apps/ccrelocate/?order={{id}}" class="button__text">Update Address</a></p>

                  {% endif %}

                   </td>


2) Copy the following code snippet to your clipboard:


    .ccupdaddr { display:inline-block; }

    .ccupdaddr .button__text { padding:10px 15px; }

    td.customer-info__item { vertical-align:top; }


Paste the css inside <style></style> before </head> for the Order Confirmation email template.


Once added, click actions at the top of the page to ‘preview’ or ‘send test email’ to confirm the button appears correctly. If correct, save the changes to the template.