CART adding categories?

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.

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 :slight_smile:
Thank you so much!

1 Like