4
4
using Umbraco . Commerce . Cms . Models ;
5
5
using Umbraco . Commerce . Core . Api ;
6
6
using Umbraco . Commerce . Core . Models ;
7
+ using Umbraco . Commerce . Core . Services ;
7
8
using Umbraco . Commerce . Extensions ;
8
9
using Umbraco . Commerce . ProductFeeds . Core . Features . FeedGenerators . Implementations ;
9
10
using Umbraco . Commerce . ProductFeeds . Core . Features . FeedSettings . Application ;
@@ -25,19 +26,22 @@ public class GoogleMerchantCenterFeedService : IProductFeedGeneratorService
25
26
"Unable to find any product with these parameters: storeId = '{StoreId}', product key= '{ProductKey}', variant key = '{VariantKey}'." ) ;
26
27
27
28
private readonly ILogger < GoogleMerchantCenterFeedService > _logger ;
28
- private readonly IProductQueryService _productQueryService ;
29
+ private readonly ICurrencyService _currencyService ;
30
+ private readonly IProductQueryService _productQueryService ;
29
31
private readonly IUmbracoCommerceApi _commerceApi ;
30
32
private readonly ISingleValuePropertyExtractorFactory _singleValuePropertyExtractorFactory ;
31
33
private readonly IMultipleValuePropertyExtractorFactory _multipleValuePropertyExtractorFactory ;
32
34
33
35
public GoogleMerchantCenterFeedService (
34
36
ILogger < GoogleMerchantCenterFeedService > logger ,
37
+ ICurrencyService currencyService ,
35
38
IProductQueryService productQueryService ,
36
39
IUmbracoCommerceApi commerceApi ,
37
40
ISingleValuePropertyExtractorFactory singleValuePropertyExtractor ,
38
41
IMultipleValuePropertyExtractorFactory multipleValuePropertyExtractorFactory )
39
42
{
40
43
_logger = logger ;
44
+ _currencyService = currencyService ;
41
45
_productQueryService = productQueryService ;
42
46
_commerceApi = commerceApi ;
43
47
_singleValuePropertyExtractorFactory = singleValuePropertyExtractor ;
@@ -192,7 +196,8 @@ private void AddPriceNode(XmlElement itemNode, Guid storeId, IPublishedElement p
192
196
}
193
197
194
198
XmlElement priceNode = itemNode . OwnerDocument . CreateElement ( "g:price" , GoogleXmlNamespaceUri ) ;
195
- priceNode . InnerText = productSnapshot . CalculatePrice ( ) ? . Formatted ( ) ;
199
+ Price calculatedPrice = productSnapshot . CalculatePrice ( ) ;
200
+ priceNode . InnerText = $ "{ calculatedPrice . WithTax . ToString ( "0.00" ) } { _currencyService . GetCurrency ( calculatedPrice . CurrencyId ) . Code } ";
196
201
itemNode . AppendChild ( priceNode ) ;
197
202
}
198
203
0 commit comments