/**
* VARIABLE PRODUCT PRICING TABLE
*/
function rp_wcdpd_switch_variable_pricing_tables(element_id) {
jQuery('.rp_wcdpd_pricing_table_variation').hide();
jQuery(element_id).show();
}
if (jQuery('.rp_wcdpd_pricing_table_variation').length) {
jQuery('input:hidden[name="variation_id"]').each(function() {
rp_wcdpd_switch_variable_pricing_tables('#rp_wcdpd_pricing_table_variation_' + jQuery(this).val());
jQuery(this).change(function() {
rp_wcdpd_switch_variable_pricing_tables('#rp_wcdpd_pricing_table_variation_' + jQuery(this).val());
});
});
}
I have a custom piece of script that I am trying to modify. The function of this is to display a Pricing Table. One product may have hundreds of pricing tables depending on what attributes are chosen. As it stands, it will only show one at a time and only if attributes are selected.
I then modified this to allow the first pricing table to display before anything is selected. This works, but the problem is that when a user selects an attribute it shows two tables instead of the attribute table replacing the first default table.
This is what was added to show the first table as default.
jQuery('.rp_wcdpd_pricing_table_variation').first().show();
So my question is how can I write this so that the default (First table is hidden) and replaced by the attribute table?