set the price to 0 on the cloned product (Spree::Code::RroductDuplicator)

This commit is contained in:
Mohamed ABDELLANI
2023-11-28 16:00:36 +01:00
parent a13e087541
commit c995f5dfbe
2 changed files with 2 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ module Spree
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

View File

@@ -71,6 +71,7 @@ describe Spree::Core::ProductDuplicator do
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)