Skip to content

Conversation

mtylty
Copy link
Member

@mtylty mtylty commented Jun 17, 2025

This pull request extends the ShopifyToolkit::MetaobjectStatements module by adding the ability to delete metaobject definitions through the Shopify GraphQL API.

New functionality for deleting Shopify metaobject definitions:

  • Method delete_metaobject_definition: Implements functionality to delete an existing metaobject definition by its type. The method includes built-in checks to skip deletion if the metaobject definition doesn't exist, providing user-friendly feedback. (lib/shopify_toolkit/metaobject_statements.rb)

Key features:

  • Uses the metaobjectDefinitionDelete GraphQL mutation from Shopify's Admin API
  • Includes proper error handling through the existing handle_shopify_admin_client_errors method
  • Gracefully handles cases where the metaobject definition doesn't exist
  • Follows the existing code patterns and conventions in the module
  • Includes the log_time decorator for performance monitoring

Implementation details:

  • Leverages the existing get_metaobject_definition_gid method to check for metaobject existence
  • Uses the same GraphQL query structure and error handling patterns as other methods in the module
  • Provides clear user feedback when attempting to delete non-existent metaobject definitions

Implements the delete_metaobject_definition method to complete the CRUD operations for metaobject definitions management API. The method follows the same patterns as create and update methods, including proper error handling and logging.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@mtylty mtylty requested review from Copilot and elia June 17, 2025 15:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new method to delete metaobject definitions via the Shopify GraphQL API.

  • Adds method delete_metaobject_definition with pre-deletion checks
  • Implements GraphQL deletion query with consistent error handling and performance logging

end

# https://shopify.dev/docs/api/admin-graphql/2024-10/mutations/metaobjectDefinitionDelete
query =
Copy link
Preview

Copilot AI Jun 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider using a heredoc to define the multi-line GraphQL query for improved readability and easier maintenance.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant