Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop setting line items with quantity of zero #5275

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Jul 21, 2023

  1. Handle empty values as quantity adding to cart via API

    Right now, when empty values are passed as quantity in the API call
    that creates line items, the line item is populated with quantity 0.
    
    This is not the expected behavior, as it makes no sense to have a line
    item with 0 as quantity.
    
    Still, if someone wants to force the value to 0, this is still possible
    but 0 needs to be explicitly passed as quantity value. A spec has been
    added for this scenario as well.
    kennyadsl authored and RyanofWoods committed Jul 21, 2023
    Configuration menu
    Copy the full SHA
    75d6ff5 View commit details
    Browse the repository at this point in the history

Commits on Jul 24, 2023

  1. Improve OrderContents#update_cart testing for nested_attributes

    Its spec was not testing single-level nested_attributes, which in the
    codebase occurs in the Api::LineItemsController [1].
    
    [1] https://github.com/solidusio/solidus/blob/df68c0c748ded6a595d28c37a9460126c6d12ecb/api/app/controllers/spree/api/line_items_controller.rb#L56-L62
    RyanofWoods committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    cb2b878 View commit details
    Browse the repository at this point in the history
  2. Update OrderContents#update_cart

    This method allows the deletion of LineItems where the quantity is set
    to 0 or less. This is possible because LineItem allows a quantity of 0
    on save, but soon this will be disallowed, so we have to manually
    destroy these LineItems and remove them from the params before saving.
    RyanofWoods committed Jul 24, 2023
    Configuration menu
    Copy the full SHA
    0d88daf View commit details
    Browse the repository at this point in the history