On Odoo17, I would like to modify the dynamic snippet of the e-commerce website, I added the following code to my own module, but it was unsuccessful
. What should I do?
/** @odoo-module **/
import { DynamicSnippetProductsCard} from "@website_sale/snippets/s_dynamic_snippet_products/000";
import { patch } from "@web/core/utils/patch";
patch(DynamicSnippetProductsCard.prototype, {
async _onClickAddToCart(ev) {
debugger
const $card = $(ev.currentTarget).closest('.card');
const data = await this.rpc("/shop/cart/update_json", {
product_id: $card.find('input[data-product-id]').data('product-id'),
add_qty: 1,
uom_id: 43,
display: false,
});
wSaleUtils.updateCartNavBar(data);
wSaleUtils.showCartNotification(this.call.bind(this), data.notification_info);
if (this.add2cartRerender) {
this.trigger_up('widgets_start_request', {
$target: this.$el.closest('.s_dynamic'),
});
}
},
});