Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Merge pull request #12741 from moonlight-rays/fix/remaining-incorrect-namespacing-in-spree-extension-creation-example

moonlight-rays01dacac0796e
diff --git a/docs/developer/contributing/creating-an-extension.mdx b/docs/developer/contributing/creating-an-extension.mdx
index 6855d43d1c..00f3a28a35 100644
--- a/docs/developer/contributing/creating-an-extension.mdx
+++ b/docs/developer/contributing/creating-an-extension.mdx
@@ -93,7 +93,7 @@ module SpreeSimpleSales
module Spree
module HomeControllerDecorator
def sale
- @products = Spree::Product.joins(:variants_including_master).where('spree_variants.sale_price is not null').distinct
+ @products = ::Spree::Product.joins(:variants_including_master).where('spree_variants.sale_price is not null').distinct
end
end
end
@@ -156,13 +156,13 @@ module SpreeSimpleSales
module VariantDecorator
def price_in(currency)
return super unless sale_price.present?
- Spree::Price.new(variant_id: self.id, amount: self.sale_price, currency: currency)
+ ::Spree::Price.new(variant_id: self.id, amount: self.sale_price, currency: currency)
end
end
end
end
-Spree::Variant.prepend SpreeSimpleSalesSpree::VariantDecorator
+Spree::Variant.prepend SpreeSimpleSales::Spree::VariantDecorator
```
If there is a `sale_price` present on the product's master variant, we return that price. Otherwise, we call the original implementation of `price_in` using `return super`.