Class: SolidusGraphqlApi::Mutations::Checkout::RemoveFromCart
- Inherits:
-
BaseMutation
- Object
- GraphQL::Schema::RelayClassicMutation
- BaseMutation
- SolidusGraphqlApi::Mutations::Checkout::RemoveFromCart
- Defined in:
- lib/solidus_graphql_api/mutations/checkout/remove_from_cart.rb
Instance Method Summary collapse
Instance Method Details
#authorized?(line_item:) ⇒ Boolean
23 24 25 |
# File 'lib/solidus_graphql_api/mutations/checkout/remove_from_cart.rb', line 23 def (line_item:) current_order.line_items.find(line_item.id) end |
#ready? ⇒ Boolean
27 28 29 |
# File 'lib/solidus_graphql_api/mutations/checkout/remove_from_cart.rb', line 27 def ready?(*) current_ability.(:update, current_order, guest_token) end |
#resolve(line_item:) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/solidus_graphql_api/mutations/checkout/remove_from_cart.rb', line 14 def resolve(line_item:) line_item = current_order.contents.remove_line_item(line_item) { order: current_order, errors: user_errors("line_item", line_item.errors) } end |