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

Spree 4.2 #206

Open
jhovad opened this issue Mar 30, 2021 · 1 comment
Open

Spree 4.2 #206

jhovad opened this issue Mar 30, 2021 · 1 comment

Comments

@jhovad
Copy link

jhovad commented Mar 30, 2021

Are you going to update it for Spree 4.2? There are some very small glitches in admin, but mainly "Add to cart" is not working. :(

@jhovad
Copy link
Author

jhovad commented Apr 21, 2021

I finally implemented my own solution, anyway for there are my points for necessary updates to Spree 4.2 compatibility:

https://github.com/spree/spree/blob/c47e591882d79e766847c627773d29186aa2224b/frontend/app/assets/javascripts/spree/frontend/views/spree/products/cart_form.js#L283
-> this pass empty param[:options]… JavaScript have to be customized for passing selected variant of the part (update of the part variant selector form to 4.2 style would be also nice)

===========

options[:selected_variants]['selected_variants'][part.part.id.to_s]

-> double of [:selected_variants]['selected_variants’] … should be only [:selected_variants]

===========

Maybe Spree issue, if not then create decorator …:
spree/spree#10986

===========

def build_inventory_unit(variant, line_item, quantity=nil)

-> outdated implementation that doubles InventoryUnits … should be maybe like

module Spree
  module Stock
    module InventoryUnitBuilderDecorator
      def units
        @order.line_items.flat_map do |line_item|
          line_item.quantity_by_variant.flat_map do |variant, quantity|
            byebug
            Spree::InventoryUnit.new(
              pending: true,
              line_item_id: line_item.id,
              variant_id: variant.id,
              quantity: quantity,
              order_id: @order.id,
            )
          end
        end
      end
    end
  end
end

… maybe another issues, but this was what I noticed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant