Skip to content
Page load link
jQuery(document).ready(function($){
console.log("Bopo script loaded ✅");
// जब popup open हो
$(document).on('click', '.bopobb-product-img-wrap', function(){
setTimeout(function(){
$('.bopobb-product').each(function(){
var item = $(this);
// prevent duplicate
if(item.hasClass('custom-added')) return;
item.addClass('custom-added');
// hide price
item.find('.bopobb-product-price').hide();
// get product ID
var productID = item.data('product');
if(!productID) return;
// UI add
item.find('.bopobb-product-title-wrap').after(`
`);
// get variations
$.post(wc_add_to_cart_params.ajax_url, {
action: 'get_variations',
product_id: productID
}, function(res){
if(res.success){
var dropdown = item.find('.custom-variation-dropdown');
res.data.forEach(function(v){
dropdown.append(``);
});
}
});
});
}, 1200); // delay for popup load
});
// Add to bundle click
$(document).on('click', '.custom-add-to-bundle', function(){
var item = $(this).closest('.bopobb-product');
var variationID = item.find('.custom-variation-dropdown').val();
if(!variationID){
alert('Please select variation');
return;
}
// IMPORTANT: trigger original Bopo selection
item.find('.bopobb-product-img-wrap').trigger('click');
});
});