Skip to content

Commit

Permalink
set the price to 0 on the cloned product (Spree::Code::RroductDuplica…
Browse files Browse the repository at this point in the history
…tor)
  • Loading branch information
abdellani committed Nov 28, 2023
1 parent a13e087 commit c995f5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/spree/core/product_duplicator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def duplicate_product
new_product.created_at = nil
new_product.deleted_at = nil
new_product.updated_at = nil
new_product.price = 0
new_product.unit_value = %w(weight volume).include?(product.variant_unit) ? 1.0 : nil
new_product.product_properties = reset_properties
new_product.image = duplicate_image(product.image) if product.image
Expand Down
1 change: 1 addition & 0 deletions spec/lib/spree/core/product_duplicator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
expect(new_product).to receive(:sku=).with("")
expect(new_product).to receive(:product_properties=).with([new_property])
expect(new_product).to receive(:created_at=).with(nil)
expect(new_product).to receive(:price=).with(0)
expect(new_product).to receive(:unit_value=).with(nil)
expect(new_product).to receive(:updated_at=).with(nil)
expect(new_product).to receive(:deleted_at=).with(nil)
Expand Down

0 comments on commit c995f5d

Please sign in to comment.