Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
How to Use Third Party Apps in the Shopify Dawn Theme Without Overriding the Original Functionality...?

I am using the dawn theme. My third-party app will override the original Add to Cart button of the Dawn theme. However, the app won't update the increment icon of the cart sign, the pop-up of the cart notification won't show as well. In the code of the product-form.js file, the icon and notification are rendered after a response is passed. Anyone can give me some hints to modify my code to keep the original feature available?

please look in the code

if (!customElements.get('product-form')) {
customElements.define('product-form', class ProductForm extends HTMLElement {
constructor() {
  super();
  this.form.addEventListener('submit', this.onSubmitHandler.bind(this)); 
  this.cart = document.querySelector('cart-notification');
}

onSubmitHandler(evt) {
  evt.preventDefault();
  const config = fetchConfig('javascript');
  config.headers['X-Requested-With'] = 'XMLHttpRequest';
  delete config.headers['Content-Type'];
  const formData = new FormData(this.form);
  fetch(`${routes.cart_add_url}`, config)
    .then((response) => response.json())
    .then((response) => {
        this.cart.renderContents(response);     //when item add //to cart, the 
                                                 //renderContents() will be called to 
                                               //show cart notification
       }
    }
  }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!