Skip to content

inCart computed property should be used (L10) #71

@lazarosmitsis

Description

@lazarosmitsis

I think a new computed property should be used to disable/enable the "Remove Item" button.
Instead of checking inStock property, a new inCart property should be used.
The "Remove Item" button should be enabled only if the product id exists in cart - not if it exists in stock!

This is the solution proposed by L10-end:

    <button 
    class="button" 
    :class="{ disabledButton: !inStock }" 
    :disabled="!inStock" 
    @click="removeFromCart">
    Remove Item
  </button>
  <!-- solution -->

This is what I would suggest:

    <button 
    class="button" 
    :class="{ disabledButton: !inCart }" 
    :disabled="!inCart" 
    @click="removeFromCart">
    Remove Item
  </button>
  <!-- solution -->

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