My theme doesn’t allow adding the block with the lowest price, what should I do?
It will be possible to add the required block in the product-price.liquid code. To proceed, follow the steps below:
1. Proceed to Online store > Themes > Customize > Edit Code.
2. Add a new snippet in the Snippets folder:
Insert the content below and save the snippet:
- <div id="am-omnibus-container-{{ product.id }}"></div>
<script>
(async () => {
const {shop, locale, currency} = window.Shopify;
if (!shop) {
return;
}
const productId = "{{ product.id }}";
if (!productId || typeof window.ShopifyAnalytics === "undefined") {
return;
}
const selectedVariantId = "{{ product.selected_or_first_available_variant.id }}";
const {page} = window.ShopifyAnalytics.meta;
const {pageType} = page;
if (pageType === "product") {
const endpoint = `/apps/am-omnibus-price`;
const response = await fetch(endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
Accept: "application/json"
},
body: JSON.stringify({
shop,
productId,
variantId: selectedVariantId,
locale,
currency
})
});
if (!response.ok) {
return;
}
const {lowestPriceHtml} = await response.json();
if (!lowestPriceHtml) {
return;
}
const selector = `am-omnibus-container-${productId}`;
const container = document.getElementById(selector);
if (!container) {
return;
}
container.innerHTML = lowestPriceHtml;
}
})();
</script>
Add the following line at the end of the product-price.liquid code:
{%- render 'product-page-lowest-price', product:product -%}
Once you save the changes, the application’s block should appear on the front end.
Related Articles
How does the Shopify Omnibus Insight: Price History app handle price increases and show the lowest price in the last X days?
If you increase the prices of your products permanently, the Omnibus Insight: Price History app will show the lowest price from the last X days, excluding the most recent price change. This means the oldest price may still display as the lowest ...
Can we set up different price lists for different markets?
Unfortunately, the moment, our solution doesn’t support price lists.
Does your solution work with B2B shared catalogues?
At the moment, our solution doesn’t support price lists, but we are currently working on adding this feature in future releases.
Why don’t some images appear in the optimization grid after analysis?
After analyzing images, only those that need optimization will appear in the grid and be available for optimization. If certain images don’t appear in the grid, it means one of the following: the images are already optimized; the images don’t meet ...
Why haven’t I received an alert email after saving an alert?
After saving an alert, a confirmation email is sent to the specified email address. To start receiving notifications, follow these steps: Check your inbox for the confirmation email and verify your address. If you don’t see the email, check your Spam ...