Skip to content

collectionByHandle is not working with variable #214

Closed
@atikju

Description

@atikju

What am I missing here? See my codes below:

$collection_handle = "my-handle";

$graphQL = <<<Query
query {
  collectionByHandle(handle: \$handle) {
    products(first: 30) {
      edges {
        node {
          images(first: 1) {
            edges {
              node {
                src
              }
            }
          }
          handle
          variants(first: 10) {
            edges {
              node {
                compareAtPrice
                price
              }
            }
          }
        }
      }
    }
  }
}
Query;

$variables = [
	"handle" => $collection_handle
];

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