Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

While adding the product to Cart when the requested Qty is zero or less then zero, one was unexpectedly added #357

Closed
TomashKhamlai opened this issue Feb 8, 2019 · 3 comments
Assignees
Labels
bug Something isn't working Component: QuoteGraphQl Contribution Day Tickets is good for start on Contribution Day

Comments

@TomashKhamlai
Copy link
Contributor

TomashKhamlai commented Feb 8, 2019

Preconditions (*)

  1. Add configurable product to Cart #224 or Add virtual products to cart #320 is merged or [Cart Operations] Add configurable product to Cart #142 is fixed (if not need to work create a new branch based on 142_Add_configurable_product_to_Cart, not 2.3-develop)

Steps to reproduce (*)

  1. Create any Product from Storefront with qty 1000 and Stock Status IN_STOCK. For example:
Key Value Value
PRODUCT TYPE SIMPLE VIRTUAL
Name Simple Product Virtual Product
SKU simple-product virtual-product
Price 10 10
qty 1000 1000
Tax Group Taxable Goods Taxable Goods
Stock Status IN_STOCK IN_STOCK
Weight 1 1
  1. Create an empty Cart from Storefront or using GraphQL API.
  2. Get the Masked Quote Id
  3. Perform GraphQL request:
mutation {
  addSimpleProductsToCart(
    input: {
      cart_id: "BVbiFodiH2s8m0HOcLvrUAKzpEJuvzHQ"
      cartItems: [{
        data: {
          sku: "simple-product"
          qty: 0
        } 
      }{
        data: {
          sku: "virtual-product"
          qty: 0
        }
      }
      ]
    }
  ) {
    cart {
      items {
        qty
        ... on SimpleCartItem {
          product {
            type_id
            name
            sku
            price {
              regularPrice {
                amount {
                  value
                }
              }
            }
            stock_status
          }
        }
        ... on VirtualCartItem {
          product{
            type_id
            name
            sku
            price {
              regularPrice {
                amount {
                  value
                }
              }
            }
            stock_status
          }
        }
      }
    }
  }
}

Expected result (*)

  1. message: "Please enter a quantity greater than 0." or at least qty in the Cart doesn't change after request

Actual result (*)

  1. Qty is increasing by one after every request
@TomashKhamlai TomashKhamlai changed the title While adding the product to Cart when the requested Qty is zero, one was unexpectedly added While adding the product to Cart when the requested Qty is zero or less then zero, one was unexpectedly added Feb 8, 2019
@naydav naydav added the Contribution Day Tickets is good for start on Contribution Day label Feb 8, 2019
@vpodorozh vpodorozh self-assigned this Feb 10, 2019
@pkodithuwakku pkodithuwakku self-assigned this Feb 11, 2019
@XxXgeoXxX XxXgeoXxX self-assigned this Feb 14, 2019
@vpodorozh vpodorozh removed their assignment Feb 14, 2019
@XxXgeoXxX XxXgeoXxX removed their assignment Feb 20, 2019
@naydav
Copy link
Contributor

naydav commented Mar 15, 2019

@TomashKhamlai
Please, recheck this bug on latest 2.3-developer branch
Thanks

@XxXgeoXxX
Copy link
Member

Hi, everyone
I reproduced this bug. It happens because Magento recheck input value by knokout(uses class 'validate-greater-than-zero':true).

@naydav naydav added bug Something isn't working Component: QuoteGraphQl labels Mar 25, 2019
@naydav
Copy link
Contributor

naydav commented Mar 26, 2019

#487

@naydav naydav closed this as completed Mar 26, 2019
@naydav naydav added this to the Release: 2.3.2 milestone Mar 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working Component: QuoteGraphQl Contribution Day Tickets is good for start on Contribution Day
Projects
None yet
Development

No branches or pull requests

5 participants