We're Moving to a New Support Platform – Starting June 1st!
We’re excited to let you know that starting June 1st, we’ll be transitioning to a new support system that will be available directly on our product websites – Amelia, wpDataTables, and Report Builder. In fact, the new support platform is already live for Amelia and wpDataTables, and we encourage you to reach out to us there.
You'll always be able to reach us through a widget in the bottom right corner of each website, where you can ask questions, report issues, or simply get assistance.
While we still do not offer live support, a new advanced, AI-powered assistant, trained on our documentation, use cases, and real conversations with our team, is there to help with basic to intermediate questions in no time.
We're doing our best to make this transition smooth and hassle-free. After June 1st, this current support website will redirect you to the new "Contact Us" pages on our product sites.
Thanks for your continued support and trust – we’re excited to bring you an even better support experience!
The below code is buggy. We were forced to comment out lines 108 to 174 to allow our users to add items to cart. The implementation of this code with no error handling is problematic and could cost site owners a lot of money until they realize the issue is happening. (Like us for example.)
This only happens when a gravity form is filled out and you try to add the item to cart. It will not add to cart. It throws an error and you are stuck on the page unable to purchase the product. VERY FRUSTERATING is what we were told by users repeatedly. Please fix your code and also implement proper error handling to avoid these issues in the future! (PS. You should also add an on off button for extended functionality like this in the settings!!! Come on guys you can do better, we believe in you.)
Throws error:
wdt.woo-commerce.js?ver=7.2:112 Uncaught TypeError: Cannot read properties of undefined (reading 'id')
at HTMLButtonElement.<anonymous> (wdt.woo-commerce.js?ver=7.2:112:99)
at HTMLBodyElement.dispatch (jquery.min.js?ver=3.7.1:2:40035)
at v.handle (jquery.min.js?ver=3.7.1:2:38006)
----------------------------------------------------------------------------------------------------------
CODE from file wpdatatables>integrations>pro>woo-commerce>assets>wdt.woo-commerce.js Line 108 to 174
----------------------------------------------------------------------------------------------------------
// Listen to add to cart events in the add_to_cart_button column
$('body').on('click', '.single_add_to_cart_button', function (e) {
e.preventDefault();
let tableId = Number(this.dataset.value);
let tableSelector = $('table.wpDataTable[data-wpdatatable_id=' + tableId + ']').get(0).id;
let button = $(this);
let productId = parseInt(button.data('product_id').toString().replace(/[^d]/g, ''), 10);
let quantity = button.closest('.wdt-woo-product').find('input[name="quantity"]').val();
let variations = {};
// Get selected variations
button.closest('.wdt-woo-variable-product').find('.wdt-woo-variation-selector').each(function () {
let attributeName = 'attribute_' + $(this).data('attribute-name');
let attributeValue = $(this).val();
variations[attributeName] = attributeValue;
});
let rowId = button.closest('tr')[0]._DT_RowIndex;
$.ajax({
url: wdt_ajax_object.ajaxurl,
type: 'POST',
data: {
action: 'wpdatatables_add_single_product_to_cart',
product_id: productId,
quantity: quantity,
variations: variations,
},
success: function (data) {
if (data.success) {
if (data.data.notAdded) {
wdtNotify(
wpdatatables_frontend_strings.error_wpdatatables,
wpdatatables_frontend_strings.could_not_add_to_cart_wpdatatables,
'danger'
)
return;
}
updateCartInfo();
// Update the specific row with a mini cart and product quantity
let cartHtml = `
<div class="wdt-woo-mini-cart" name="wdt-woo-mini-cart">
<a href="${data.data.cart_url}" class="wdt-woo-mini-cart-icon">
<i class="wpdt-icon-cart"></i>
<span class="wdt-woo-cart-quantity">${data.data.product_quantities}</span>
</a>
</div>
`;
let table = wpDataTables[tableSelector].DataTable();
let columnIndex = getColumnIndexByHeader('add_to_cart_button', tableSelector)
let currentContent = table.cell(rowId, columnIndex).node();
if (!currentContent.children.namedItem('wdt-woo-mini-cart')) {
$(currentContent).append(cartHtml);
} else {
$(currentContent).find('.wdt-woo-mini-cart').find('span.wdt-woo-cart-quantity').text(data.data.product_quantities)
}
} else {
wdtNotify(
wpdatatables_frontend_strings.error_wpdatatables,
wpdatatables_frontend_strings.error_adding_to_cart_wpdatatables,
'danger'
)
}
}
});
});