From 528c3e311a04f66d0256b820bdaa4df97bcef11c Mon Sep 17 00:00:00 2001 From: jbrw Date: Tue, 8 Mar 2022 15:24:45 -0500 Subject: [PATCH] FIX: Only display the first listed price (#16138) Multiple prices may be returned by Amazon (e.g. for new, and also for used). We should only display the first price. --- lib/onebox/engine/amazon_onebox.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/onebox/engine/amazon_onebox.rb b/lib/onebox/engine/amazon_onebox.rb index c30904067bd..9f1aca9f833 100644 --- a/lib/onebox/engine/amazon_onebox.rb +++ b/lib/onebox/engine/amazon_onebox.rb @@ -124,7 +124,7 @@ module Onebox elsif !raw.css("#priceblock_ourprice").inner_text.empty? raw.css("#priceblock_ourprice").inner_text else - result = raw.css('#corePrice_feature_div .a-price .a-offscreen').inner_text + result = raw.css('#corePrice_feature_div .a-price .a-offscreen').first&.inner_text if result.blank? result = raw.css(".mediaMatrixListItem.a-active .a-color-price").inner_text end