Daniel
November 8, 2021, 10:37pm
#41
I titled the new product “editorial”.
Added Attribut Name “Type of usage”
Added option 1 “book”, option 2 “magazin”
With the options the cart provides, I think combining category and option into “editorial - book”, “editorial - magazine”, etc might be the workaround.
Ben
November 9, 2021, 3:38am
#42
Hi @volvoxturbo , moving the code into another hook solves the problems with the percentages. Here’s the hooks file with that change:
if ("ttgCart" in window) {
ttgCart.post_populate_buy_buttons = function() {}
ttgCart.post_get_pricing = function() {}
ttgCart.pre_open_modal = function() {}
ttgCart.post_open_modal = function() {
var element = $('input[value=Usage]').parent().detach();
$('div#productSelector').prepend(element);
}
ttgCart.add_success = function() {}
ttgCart.add_error = function() {}
ttgCart.post_cancel_modal = function() {}
ttgCart.pre_load_widget = function() {}
ttgCart.post_load_widget = function() {}
ttgCart.post_click_add_button = function() {
console.log('post_click_add_button called');
$('select.purchaseOption option').each(function() {
var updated = ($(this).html().replace(/ \+ [0-9].*%$/, ''));
$(this).html(updated);
});
}
}
Dear Ben,
that did it
Thank you so much!
1 Like