Sample
diff --git a/addons/website_sale/models/website_snippet_filter.py b/addons/website_sale/models/website_snippet_filter.py
index c1ed74a2307..a44ee16be4e 100644
--- a/addons/website_sale/models/website_snippet_filter.py
+++ b/addons/website_sale/models/website_snippet_filter.py
@@ -59,6 +59,8 @@ class WebsiteSnippetFilter(models.Model):
product = res_product.get('_record')
if not is_sample:
res_product.update(product._get_combination_info_variant())
+ if records.env.context.get('add2cart_rerender'):
+ res_product['_add2cart_rerender'] = True
return res_products
@api.model
@@ -108,7 +110,7 @@ class WebsiteSnippetFilter(models.Model):
domain,
[('id', 'in', products_ids)],
])
- products = self.env['product.product'].with_context(display_default_code=False).search(domain, limit=limit)
+ products = self.env['product.product'].with_context(display_default_code=False, add2cart_rerender=True).search(domain, limit=limit)
return products
def _get_products_recently_sold_with(self, website, limit, domain, context):
diff --git a/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/000.js b/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/000.js
index 65f107f1326..23ce6bbf916 100644
--- a/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/000.js
+++ b/addons/website_sale/static/src/snippets/s_dynamic_snippet_products/000.js
@@ -97,11 +97,20 @@ const DynamicSnippetProducts = DynamicSnippetCarousel.extend({
var animation = wSaleUtils.animateClone($navButton, $(ev.currentTarget).parents('.card'), 25, 40);
Promise.all([fetch, animation]).then(function (values) {
wSaleUtils.updateCartNavBar(data);
- self._render();
+ if (self.add2cartRerender) {
+ self._render();
+ }
});
});
},
-
+ /**
+ * @override
+ * @private
+ */
+ _renderContent() {
+ this._super(...arguments);
+ this.add2cartRerender = !!this.el.querySelector('[data-add2cart-rerender="True"]');
+ },
/**
* Remove product from recently viewed products.
* @private