We can prevent customers from proceeding to checkout if they have reorder items from my account and they have not review the reordered item options and we can enable the button once they have reviewed using below solution.
create two new item options to store reordered and reviewed value
reordered custcol_ag_isreordered
reviewed custcol_ag_is_reviewed
Myaccount Entrypoint
_.extend(ReorderItemsActionsAddToCartView.prototype, {
getContext: _.wrap(ReorderItemsActionsAddToCartView.prototype.getContext, function (fn) {
try {
const context = fn.apply(this, _.toArray(arguments).slice(1));
if (this.model.get('item').get("custitem_jj_liq_pixels_personalization")) {
_.each(this.model.get("options").models, opt => {
if (opt.get('cartOptionId') === "custcol_ag_isreordered") {
opt.set("value", { "label": "Yes", "internalid": "T" });//setting as reordeed
}
if (opt.get('cartOptionId') === "custcol_ag_is_reviewed") {
opt.set("value", { "label": "No", "internalid": "F" });//setting it as not reviewd
}
})
}
return {
...context
}
} catch (error) {
console.error("ERROR @ OrderHistoryItemActionsView", error);
}
})
})
_.extend(OrderHistoryItemActionsView.prototype, {
getContext: _.wrap(OrderHistoryItemActionsView.prototype.getContext, function (fn) {
try {
const context = fn.apply(this, _.toArray(arguments).slice(1));
if (this.model.get("item").get("custitem_jj_liq_pixels_personalization")) {
_.each(this.model.get("options").models, opt => {
if (opt.get('cartOptionId') === "custcol_ag_isreordered") {
opt.set("value", { "label": "Yes", "internalid": "T" });//setting as reordeed
}
if (opt.get('cartOptionId') === "custcol_ag_is_reviewed") {
opt.set("value", { "label": "No", "internalid": "F" });//setting it as not reviewd
}
})
}
return {
...context
}
} catch (error) {
console.error("ERROR @ OrderHistoryItemActionsView", error);
}
})
})
Shopping EntryPoint:
_.extend(CartLinesView.prototype, {
initialize: _.wrap(CartLinesView.prototype.initialize, function (fn) {
var self = this;
fn.apply(this, _.toArray(arguments).slice(1));
this.on('afterViewRender', function () {
_.defer(() => {
if ($('.cart-summary-button-container .info-message-holder').length === 0) {
$('.cart-summary-button-container').prepend('<div class="info-message-holder"></div>')
}
_.each(self.model.get('options').models, option => {
const isReordered = option.get('cartOptionId') === "custcol_ag_isreordered" && option.get('value') && option.get('value').internalid === "T";
const reviewed = _.find(self.model.get('options').models, opt=>opt.get('cartOptionId') === "custcol_ag_is_reviewed");
if (isReordered && reviewed.get('value').internalid === 'F') {
$('.cart-summary-button-proceed-checkout').addClass("disabled");
$('.cart-summary-button-container .info-message-holder').html("");
$('.cart-summary-button-container .info-message-holder').append( new GlobalViewsMessageView({
message: 'Cart contains the reordered items. Please review them before proceeding to checkout.',
type: 'error',
closable: false
}).render().$el.html())
}
})
})
});
}),
});
Set item option custcol_ag_is_reviewed to true when item is edited in QuickView only for the reordered items,
const pdp = SC.Application.getComponent("PDP")
pdp.setOption('custcol_ag_is_reviewed', 'T');