Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Triggering product form submit via JavaScript results in error (but clicking add to cart works as expected) #171

@cfxd

Description

@cfxd

This may be down to my mediocre JavaScript skills, but I'm struggling to figure out why triggering a submit event on the default product form results in an Oops! page from Shopify with the message Parameter Missing or Invalid: Required parameter missing or invalid: items (see screenshot below, too).

Steps to reproduce:

  1. Visit product page on new Slate install
  2. Open console and run document.querySelector('.shopify-product-form').submit();

Best I can tell, triggering the even in this way results in the theme script not executing _setIdInputValue(), but I'd like to understand why or know a better way to trigger submit.

My overall goal is to pause form submission, then add an item to cart using AJAX in the background, and upon completion, resume form submission and add the original product to the cart.

I'm using the latest Slate and have updated all of my deps. Any insight would be much appreciated.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions