Skip to content

Stock logic not working with manage_stock: false #3957

@eerohakio

Description

@eerohakio

Current behavior

Using Magento and setting manage_stock false for product leads to situation where product cannot be added to cart. This is because maxQuantity for product is checked from stock.qty and theres no logic for manage_stock attribute.

Expected behavior

If manage_stock is false no qty should be checked when adding product to cart or showing add to cart button

Steps to reproduce the issue

  1. Set product in Magento with manage stock false
  2. Go to product page
  3. Add to cart button is disabled

Repository

https://github.com/DivanteLtd/vue-storefront/blob/master/src/themes/default/pages/Product.vue#L411

Environment details

  • Browser: Chrome 79.0.3945.88
  • OS: Centos 8
  • Node: v10.16.0
  • Code Version: v1.11.0

Additional information

As the maxQuantity is also used for showing amount in frontend I did come up with easy fix with adding this logic
this.maxQuantity = res.manage_stock ? res.qty : ' '
This way !this.maxQuantity === false as whitespace in string is counted as truthy value. Maybe not correct solution but add to cart works with this and no weird info shown for customer in stock field just ( available).

Also I think this issue is not that critical as most of the folks are using stock from eCom but in case someone doesn't this is blocker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3: NormalPriority mark - normal prioritybugBug reports

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions