app/controllers/spree/admin/variants_controller.rb
# override the destroy method to set deleted_at value
# instead of actually deleting the product.
override the destroy method to set deleted_at value
instead of actually deleting the product.
override the destroy method to set deleted_at value instead of actually deleting the product .
def destroy
        @variant = parent.variants.find(params[:id])
        if @variant.destroy
          flash[:success] = Spree.t('notice_messages.variant_deleted')
        else
          flash[:error] = Spree.t('notice_messages.variant_not_deleted', error: @variant.errors.full_messages.to_sentence)
        end
        respond_with(@variant) do |format|
          format.html { redirect_to spree.admin_product_variants_url(params[:product_id]) }
          format.js { render_js_for_destroy }
        end
      end
def destroy @variant = parent . variants . find ( params [ :id ] ) if @variant . destroy flash [ :success ] = Spree . t ( 'notice_messages.variant_deleted' ) else flash [ :error ] = Spree . t ( 'notice_messages.variant_not_deleted' , error : @variant . errors . full_messages . to_sentence ) end respond_with ( @variant ) do | format | format . html { redirect_to spree . admin_product_variants_url ( params [ :product_id ] ) } format . js { render_js_for_destroy } end end
override the destroy method to set deleted_at value
instead of actually deleting the product.
override the destroy method to set deleted_at value instead of actually deleting the product .